Skip to content

Instantly share code, notes, and snippets.

@Kasahs
Kasahs / covid-treatment-protocol.md
Last active May 7, 2021
Dr. KK Aggarwal's covid management protocol
View covid-treatment-protocol.md

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 Dec 17, 2020
Cosine similarity of two string vectors
View cosine-match.py
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 Dec 17, 2020
A python script to return all lines in the input file in descending order of edit distance from the input string
View sort-by-edit-distance.py
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
Team communication protocol
View comm_protocol.md

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 Jun 10, 2019
To disconnect all containers attached to a network
View docker-network-disconnect.sh
# 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 Jun 4, 2019
a template for creating pull requests
View pull-request-template.md

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 Feb 1, 2019
A modified version of zsh theme "bira" to make copying branch names easier
View shasak.zsh-theme
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 Dec 12, 2018
batching helper
View batcher.js
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 Sep 26, 2018
check if a number belongs to an AP described by first, last term and the diff
View belongsToAP.js
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
}
@Kasahs
Kasahs / comment-regex.js
Created Sep 26, 2018
regex for matching lines that are c style comments
View comment-regex.js
const regex = /^\/\/.*|\/\*(.|\s)*?\*\//gm;
const str = `/**
asdnajsndjk
*/
// asdaskdbjkasdasdasdbjk
asdasdasdasdbjhbcjahbhj
asdbhkbajkbkcbasdasdas
//asdnbakjnbjknbjkansd
/**
asdnjkanskjdbnkjbjkbdkbjkbjkabsd