Skip to content

Instantly share code, notes, and snippets.

View hiraksarkar's full-sized avatar

Hirak Sarkar hiraksarkar

View GitHub Profile
@hiraksarkar
hiraksarkar / some_cool_plots.py
Created December 11, 2020 02:00
some cool plots
plt.figure(figsize=(8, 8))
df = np.log(variance_trio_df[['var_mean','merged_var']]+1)
df.loc[:,'color'] = 'b'
df.loc[(df.merged_var - df.var_mean) < -1, 'color'] = 'r'
colors = ["b", "r"]
customPalette = sns.set_palette(sns.color_palette(colors))
ax = sns.scatterplot(
x = 'var_mean',
y = 'merged_var',
data = df,
@hiraksarkar
hiraksarkar / parse_unix_time.sh
Created October 27, 2020 00:47
extract_json_from_time
#!/usr/bin/bash
tfile=$1
usr=`rg "(\d+\.\d+)user" $tfile -or '$1'`
sys=`rg "(\d+\.\d+)system" $tfile -or '$1'`
elap=`rg "([\d:\.]+)elapsed" $tfile -or '$1'`
mem=`rg "(\d+)maxresident" $tfile -or '$1'`
tot_elap=`echo "$elap" | sed -E 's/(.*):(.+):(.+)/\1*3600+\2*60+\3/;s/(.+):(.+)/\1*60+\2/' | bc`

Keybase proof

I hereby claim:

  • I am hiraksarkar on github.
  • I am hiraksarkar (https://keybase.io/hiraksarkar) on keybase.
  • I have a public key whose fingerprint is 4152 B3E7 7BE1 83B0 1E53 8B80 2EDB 3721 028D 527A

To claim this, I am signing this object:

use ndarray::prelude::*;
fn std1d(a: ArrayView1<'_, f64>) -> f64 {
let n = a.len() as f64;
if n == 0. {
return 0.;
}
let mean = a.sum() / n;
(a.fold(0., |acc, &x| acc + (x - mean).powi(2)) / n).sqrt()
}
@hiraksarkar
hiraksarkar / gist:25f9cc89be0471f4e6666ee9eeebd940
Created June 27, 2019 23:24
Python file for coverage plots
import glob
import pandas as pd
import tqdm
#from pyfasta import Fasta
#%matplotlib inline
import matplotlib
matplotlib.use('agg')
import matplotlib.pyplot as plt
import seaborn as sns
from collections import defaultdict
@hiraksarkar
hiraksarkar / spacemacs-keybindings
Created June 12, 2019 03:00 — forked from adham90/spacemacs-keybindings
spacemacs keybindings that i need to learn
SPC s c remove highlight
**** Files manipulations key bindings
Files manipulation commands (start with ~f~):
| Key Binding | Description |
|-------------+----------------------------------------------------------------|
| ~SPC f c~ | copy current file to a different location |
| ~SPC f C d~ | convert file from unix to dos encoding |
| ~SPC f C u~ | convert file from dos to unix encoding |
@hiraksarkar
hiraksarkar / chit_sheet.md
Last active March 13, 2019 23:39
chit sheet everyday

PATH that worked in newton

export PATH="/home/linuxbrew/.linuxbrew/bin/:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/lib/jvm/java-8-oracle/bin:/usr/lib/jvm/java-8-oracle/db/bin:/usr/lib/jvm/java-8-oracle/jre/bin:/home/linuxbrew/.linuxbrew/bin/:/home/linuxbrew/.linuxbrew/bin/"

hello

Transferring files from newton

shuf -n 1000 /bio2/home/mferdman/paired.bulk-only > oct_28/file_list\

1. Clone your fork:

git clone git@github.com:YOUR-USERNAME/YOUR-FORKED-REPO.git

2. Add remote from original repository in your forked repository:

cd into/cloned/fork-repo
git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git
git fetch upstream
#include "concurrentqueue.h"
#include "blockingconcurrentqueue.h"
#include <thread>
#include <atomic>
#include <vector>
#include <iostream>
using namespace moodycamel ;
using namespace std ;
@hiraksarkar
hiraksarkar / auto_sub2.sh
Created December 21, 2018 17:38
check queue for empty place and submit
#!/bin/bash
MAX_LIMIT=12
#number of things queue
#CHEKC IF it less than try submeating jobs
while : ; do
NUM_QUEUED=`qstat -u moamin | awk '$10 == "Q" { count++ } END {print count }'`
NUM_RUNNING=`qstat -u moamin | awk '$10 == "R" { count++ } END {print count }'`
MAX_RUNNING=`qstat -u moamin | awk '$10 == "R" { print $4 }' | cut -d"_" -f3 | sort -n | tail -1`
MAX_SUBMITTED=`qstat -u moamin | awk '$10 == "Q" { print $4 }' | cut -d"_" -f3 | sort -n | tail -1`