Skip to content

Instantly share code, notes, and snippets.

View d3banjan's full-sized avatar

Debanjan d3banjan

View GitHub Profile
@d3banjan
d3banjan / input.specs.md
Last active August 29, 2015 14:04
Input File Specification

CONVENTION

Numbered Lists are tree nodes, bullet lists are leaves (i.e key-value pairs)

MULTILAYERCNTL

  1. GENERIC
  • LUNIT
  • TRACE
  • EPERP
@d3banjan
d3banjan / scrollable_data.dat
Created August 6, 2014 15:26
datafile for SO question
NFI T[PSEC] T[K] EKIN(PSI) E(RHO) ECONS ANNEE ANNER
!> 1 0.00012 0 0.45873 16.26904 16.72777 0.30000 0.00000
!> 2 0.00024 0 1.53365 13.91887 15.45251 0.29100 0.00000
!> 3 0.00036 0 2.57649 10.44460 13.02109 0.28227 0.00000
!> 4 0.00048 0 3.27986 6.47437 9.75423 0.27380 0.00000
!> 5 0.00060 0 3.76512 2.20938 5.97450 0.26559 0.00000
!> 6 0.00073 0 4.07033 -2.21948 1.85085 0.25762 0.00000
!> 7 0.00085 0 4.01375 -6.33776 -2.32402 0.24989 0.00000
!> 8 0.00097 0 3.47760 -9.51439 -6.03679 0.24239 0.00000
!> 9 0.00109 0 2.67940 -11.61643 -8.93703 0.23512 0.00000
@d3banjan
d3banjan / 0_reuse_code.js
Last active August 29, 2015 14:06
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
module ConstrainedTypes =
open System
// General hints on defining types with constraints or invariants
//
// Just as in C#, use a private constructor
// and expose "factory" methods that enforce the constraints
//
// In F#, only classes can have private constructors with public members.
//
@d3banjan
d3banjan / issuewise.md
Last active June 29, 2017 16:01
Suggestions for initiating discussions in how an issue is posed

Sample 1

The gender roles as exist in human societies as of a late is more of a social construct than biological. Sure biology has played it's part, but our positions are more conditioned than being biological(innate). We shall solve half our problems if we deconstruct existing notions of sex and sexuality. http://www.therobinhead.com/gender-roles/

Alternative:

Existing gender roles in our societies are a social construct not biological. Separating notions of sex and sexuality will definitely solve the gender-based problems in our society. This webcomic humorously depicts how an alien would feel uncomfortable with our propensity for discretely categorising people.

Observations on original phrasing:

@d3banjan
d3banjan / demo.py
Created April 7, 2018 15:32
medium-dscookiecutter-example snip01
import os
from dotenv import find_dotenv,load_dotenv
print(find_dotenv())
#>/home/debanjan/git-projects/medium-dscookiecutter-example/src/.env
print(load_dotenv(find_dotenv()))
#>True
keys = "CONFIG_PATH DOMAIN EMAIL".split()
for key in keys:
print(key,os.getenv(key))
#>CONFIG_PATH /home/debanjan/.config/foo
@d3banjan
d3banjan / demo.py
Created April 7, 2018 15:33
medium-dscookiecutter-example snip02
import os, click, logging
@click.command()
@click.option('--option',default='default')
@click.argument('string',nargs=-1)
def main(option,string):
print("the argument(s) is(are) \"{}\" with an optional modifier {}".format(",".join(string),option))
if __name__=='__main__':
main()
@d3banjan
d3banjan / demo.py
Last active April 7, 2018 15:54
medium-dscookiecutter-example snip03
import os, click, logging
@click.group()
def meta_command():
pass
@click.command()
@click.option('--option',default='default')
@click.argument('string',nargs=-1)
def first(option,string):
@d3banjan
d3banjan / notes.md
Last active April 9, 2018 11:53
ankhi - setting up the code

what is a conda environment?

  • in python or R, we need to install packages to add functionality to our programs so that we do not have to program everything by ourselves.
  • sometimes as the version of a package evolves, it might change behaviour. As a result of this, the code that we wrote two years ago, might not run out of the box anymore.
  • even if we do get our code to run properly, it is truly a mightmare to send our code to others and expect them to run it.
  • python environments are a solution intended for the above scenarios, where an environment can be trusted to maintain a specfic version of a packages, even if the packages are upgraded. It also becomes easy to send our code to someone else, where they can install the software mentioned in our project directory called requirements.txt.
  • conda environments offer the same feature as above, but for both python and R.
@d3banjan
d3banjan / download-chunker.sh
Last active September 15, 2018 09:05
download large files in chunks
#! /bin/bash
LARGE_FILE_URL="http://vatic2.stanford.edu/stanford_campus_dataset.zip"
APPROX_SIZE=`echo "69*1024*1024*1024"| bc`
CHUNKSIZE=`echo "128*1024*1024" | bc`
NCHUNKS=`echo "1+ (($APPROX_SIZE)/($CHUNKSIZE))" | bc`
STARTCHUNK="1"
OUTDIR="/media/debanjan/xxx"
OUTFILE="stanford_campus_dataset.zip"
SLEEP_INTERVAL="10"
for ichunk in $(seq -f '%05g' 1 $NCHUNKS);