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 / .env
Last active April 22, 2024 03:56
Update Atlassian Confluence Page with Table format
CONFLUENCE_TOKEN=<TOKEN>
CONFLUENCE_INSTANCE=<confluence.server.com>
@sajalshres
sajalshres / logparser.py
Created October 12, 2023 03:41
Parse logs and extract unique stacktrace
import re
import os
import hashlib
import argparse
from typing import List
def get_argsparser() -> argparse.ArgumentParser:
"""Initialize and return the argument parser."""
parser = argparse.ArgumentParser(
@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")
@sajalshres
sajalshres / hosts
Last active September 21, 2022 15:53
Ansible playbook for local environment
devmachine ansible_connection=local
@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 / deadsnakes-python39-ubuntu-bionic.md
Created August 13, 2021 08:49
Deadsnakes python 3.9 on Ubuntu 18.04 LTS

Deadsnakes python 3.9 on Ubuntu 18.04 LTS

The deadsnakes PPA make the latest stable versions of python available on Ubuntu 18.04 LTS (3.9 is already in the official apt repo for 20.04). I now find it preferable to installing from source.

The following was tested on a Ubuntu 18.04.5 LTS desktop with python 3.6.9 as the system python version ("python3").

The latest python available from deadsnakes as of July, 2021 is 3.9.6.

Installation Procedure

@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 / 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 / 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 / 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 ):
"""