Skip to content

Instantly share code, notes, and snippets.

View Kasahs's full-sized avatar

Shasak Raina Kasahs

  • O4S
  • Gurugram, India
View GitHub Profile
@Kasahs
Kasahs / git-release-commands.md
Last active October 27, 2022 07:50
Helpful git commands to manage releases

Useful Git Commands for Release Management

Find un-merged commits

# list all commits in `master` not present in `pre-prod`
git log --no-merges master ^pre-prod

# for a nicer one-line-per-commit format use this
 git --no-pager log --pretty=format:"%h%x09%an%x09%ad%x09%s" --no-merges master ^pre-prod
@Kasahs
Kasahs / covid-treatment-protocol.md
Last active May 7, 2021 10:48
Dr. KK Aggarwal's covid management protocol

COVID Management Protocols

as suggested in Dr KK Aggarwal's online OPD (screenshot)

DO NOT self diagnose. ALWAYS consult a doctor. This document is just for the purpose of cross-referencing. Please do follow the advise of your own Doctor.

Code 1: CONTACT

Indicators: You are in contact with someone with COVID like symptoms.

  • Ivermectin 12mg daily x 3 days
  • Doxycycline 100mg daily x 3 days
  • If CRP > 1: Colchicine 0.5mg one daily x 21 days
@Kasahs
Kasahs / cosine-match.py
Last active December 17, 2020 17:40
Cosine similarity of two string vectors
import math
import re
import sys
from collections import Counter
WORD = re.compile(r"\w+")
def get_cosine(vec1, vec2):
intersection = set(vec1.keys()) & set(vec2.keys())
@Kasahs
Kasahs / sort-by-edit-distance.py
Created December 17, 2020 15:04
A python script to return all lines in the input file in descending order of edit distance from the input string
from difflib import ndiff
import sys
def distance(str1, str2):
a = 0
r = 0
for x in ndiff(str1, str2):
if x[0] == "-":
@Kasahs
Kasahs / comm_protocol.md
Last active May 20, 2021 14:57
Team communication protocol

Guidelines for Team Communication on Slack

In order to streamline communication across the company, we have decided use Slack as the central communication platform.

  • All internal communication happening on whatsapp will be ported to slack.
  • list of official channels is provided below, in case it is not obvious which whatsapp group maps to which channel just ask on#help-slack.
  • Whatsapp groups involving external vendors and clients will remain open, all others are now deprecated.

Please go through the list of official channels below and also read through the FAQs. This document is fairly loose, in case of any confusions or clarifications necessary, post on channel #help-slack so we can discuss and improve this document over time.

@Kasahs
Kasahs / docker-network-disconnect.sh
Created June 10, 2019 08:04
To disconnect all containers attached to a network
# to disconnect all containers attached to a network
for i in ` docker network inspect -f '{{range .Containers}}{{.Name}} {{end}}' network_name`; do docker network disconnect -f network_name $i; done;
@Kasahs
Kasahs / pull-request-template.md
Created June 4, 2019 11:36
a template for creating pull requests

Description

Please include a summary of the change and which issue is fixed.
Please also include relevant motivation and context.
List any dependencies that are required for this change.

Fixes #<asana-id>

Type of change

@Kasahs
Kasahs / shasak.zsh-theme
Last active February 1, 2019 07:17
A modified version of zsh theme "bira" to make copying branch names easier
local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})"
if [[ $UID -eq 0 ]]; then
local user_host='%{$terminfo[bold]$fg[red]%}%n%{$reset_color%}'
local user_symbol='#'
else
local user_host='%{$terminfo[bold]$fg[green]%}%n%{$reset_color%}'
local user_symbol='$'
fi
@Kasahs
Kasahs / batcher.js
Created December 12, 2018 13:53
batching helper
function* batches(volume, batchSize) {
let parts = Math.ceil(volume / batchSize)
for (let i = 0; i < parts; i++) {
yield { value: Math.min(volume, batchSize), index: i }
volume -= batchSize
}
}
@Kasahs
Kasahs / belongsToAP.js
Created September 26, 2018 12:20
check if a number belongs to an AP described by first, last term and the diff
const belongsToAP = (first, diff, last) => {
return num => {
if (num < first || num > last) {
return false
}
const res = (num - first) / diff + 1
if (Number.isInteger(res)) {
return true
}