Skip to content

Instantly share code, notes, and snippets.

View sajalshres's full-sized avatar
🏠
Working from home

Sajal Shrestha sajalshres

🏠
Working from home
  • Cotiviti Technologies
  • Kathmandu, Nepal
View GitHub Profile
@sajalshres
sajalshres / VS Code Settings
Created April 2, 2020 16:11
VS Code Settings for Settings Sync
# Test
@sajalshres
sajalshres / API.md
Created April 27, 2020 08:12 — forked from iros/API.md
Documenting your REST API

Title

<Additional information about your API call. Try to use verbs that match both request type (fetching vs modifying) and plurality (one vs multiple).>

  • URL

    <The URL Structure (path only, no root url)>

  • Method:

@sajalshres
sajalshres / Raymond Hettinger - Beyond PEP 8 -- Best practices for beautiful intelligible code - PyCon 2015.md Raymond Hettinger - Beyond PEP 8 -- Best practices for beautiful intelligible code - PyCon 2015. Distillation of knowledge gained from a decade of Python consulting, Python training, code reviews, and serving as a core developer. (https://www.youtube.com/watch?v=wf-BqAjZb8M)

Raymond Hettinger's professional at doing code review and architecture review

P vs. NP. Pythonic vs. Non-Pythonic.

How to make use of PEP 8

  1. Golden rule of PEP-8: PEP-8 onto yourself. PEP 8 is style guide, not a law book.
  2. Care about intelligibility, not simply visually better
  3. Transforming (Java) API to pythonic ones

Why not PEP 8

@sajalshres
sajalshres / AESCipher.py
Created June 16, 2020 12:48 — forked from crmccreary/AESCipher.py
Encryption using pycrypto, AES, and PKCS5 padding
from Crypto.Cipher import AES
from Crypto import Random
BS = 16
pad = lambda s: s + (BS - len(s) % BS) * chr(BS - len(s) % BS)
unpad = lambda s : s[0:-ord(s[-1])]
class AESCipher:
def __init__( self, key ):
"""
@sajalshres
sajalshres / README.md
Last active January 5, 2021 04:11
A simple file upload utility in Python

File Upload

A simple module to upload file to an endpoint

Usage

❯ python .\file_upload.py -h
usage: file_upload.py [OPTIONS] [FILE]...
@sajalshres
sajalshres / settings.json
Created March 12, 2021 13:50 — forked from thomasmaurer/settings.json
My Windows Terminal Settings settings.json February 2021
// This file was initially generated by Windows Terminal 1.3.2651.0
// It should still be usable in newer versions, but newer versions might have additional
// settings, help text, or changes that you will not see unless you clear this file
// and let us generate a new one for you.
// To view the default settings, hold "alt" while clicking on the "Settings" button.
// For documentation on these settings, see: https://aka.ms/terminal-documentation
{
"$schema": "https://aka.ms/terminal-profiles-schema",
@sajalshres
sajalshres / Activate Office 2019 for macOS VoL.md
Created April 18, 2021 06:21 — forked from zthxxx/Activate Office 2019 for macOS VoL.md
crack activate office on mac with license file

Activate MS Office 2019/2016 for macOS - Microsoft_Office_2019_VL_Serializer

Office 2019 above

2019-06-03

Note that Office2019 DO NOT support activate via simple copy/paste plist license file which is the simplest way to activate Office 2016. Fortunately, you can also use the VL Serializer tool, just install Office 2019 and Serializer, then run Serializer to activate.

Ref

@sajalshres
sajalshres / .editorconfig
Created June 28, 2022 15:10
VSCode editorconfig example
root = true
[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
curly_bracket_next_line = false
@sajalshres
sajalshres / hosts
Last active September 21, 2022 15:53
Ansible playbook for local environment
devmachine ansible_connection=local
@sajalshres
sajalshres / codedeploy.py
Created March 29, 2023 18:10
Trigger Code Deploy
import boto3
import sys
import time
from os import getenv
region_name = getenv("PROJECT_AWS_REGION")
account_id = getenv("PROJECT_AWS_ACCOUNTID")
assume_role_name = getenv("PROJECT_AWS_IAM_ROLENAME")
aws_access_key_id = getenv("PROJECT_AWS_ACCOUNT_ACCESSKEY")
aws_secret_access_key = getenv("PROJECT_AWS_ACCOUNT_SECRETKEY")