This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CUTOFF_IN_DAYS = 7 | |
function cleanEmail() { | |
const searchQueries = [ | |
"bigrock.com", | |
"instahyre.com", | |
"accounts.google.com", | |
] | |
searchQueries.forEach(searchText => { | |
const search = "from:"+searchText + " older_than:"+CUTOFF_IN_DAYS+"d" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ARGS_TEXT=""" | |
Usage: mkcdaliases {folder alias name} {folder to reach} | |
Eg: mkcdaliases myfolder ./my-folder | |
This creates a command -> cdmyfolder which navigates to my-folder | |
""" | |
_mkcdaliases() { | |
folder_alias=$1 | |
folder=$2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
alias reloadzshrc="source ~/.zshrc" | |
# Python aliases | |
alias activatevenv="source venv/bin/activate" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
csvheader=`head -1 small_0.csv` | |
ls small_*.csv | xargs sed -i '1d' | |
echo $csvheader > merged.csv | |
cat small_*.csv >> merged.csv |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import string | |
def int_to_str_base(decimal: int, base: int) -> str: | |
other_base = "" | |
while decimal != 0: | |
other_base = ALPHANUMERIC_CHARS[decimal % base] + other_base | |
decimal = int(decimal / base) | |
if other_base == "": | |
other_base = "0" | |
return other_base |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Runs the run_job function in parallel | |
run_job() { | |
/path/to/script.ext <args(optional)> $1 > "logs/$1.log" 2>&1 | |
} | |
export -f run_job | |
# limits.txt file has the args for the run_job function. | |
# -j4 => run 4 threads at max in parallel | |
# --eta => print the eta of the jobs on the console |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Credit: https://stackoverflow.com/a/53269966/2594980 | |
csvheader=`head -1 bigfile.csv` | |
split -d -l10000 bigfile.csv smallfile_ | |
find .|grep smallfile_ | xargs sed -i "1s/^/$csvheader\n/" | |
sed -i '1d' smallfile_00 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://stackoverflow.com/questions/12813633/how-to-assert-two-list-contain-the-same-elements-in-python/31832447 | |
list_1 = [{'unique_id':'001', 'key1':'AAA', 'key2':'BBB', 'key3':'EEE'}, | |
{'unique_id':'002', 'key1':'AAA', 'key2':'CCC', 'key3':'FFF'}] | |
list_2 = [{'unique_id':'001', 'key1':'AAA', 'key2':'DDD', 'key3':'EEE'}, | |
{'unique_id':'002', 'key1':'AAA', 'key2':'CCC', 'key3':'FFF'}] | |
def compare_list_of_dicts(list_1, list_2): | |
pairs = zip(list_1, list_2) | |
return any(x != y for x, y in pairs) |