Skip to content

Instantly share code, notes, and snippets.

@hsingh23
hsingh23 / gist:6444301
Last active December 22, 2015 08:19 — forked from hann2/gist:6443466
from string import split
class Table:
def __init__(self):
self.labels = []
self.data = []
def populate(self, file_name, col_delim="\t", row_delim="\n", data_start=None):
with open(file_name, 'r') as f:
if data_start:
#!/bin/bash
# Script for installing tmux on systems where you don't have root access.
# tmux will be installed in $HOME/local/bin.
# It's assumed that wget and a C/C++ compiler are installed.
# exit on error
set -e
TMUX_VERSION=1.9a
@hsingh23
hsingh23 / gist:9da3ce980c251079ef54
Created May 26, 2015 18:56
mutation observer jquery
// The node to be monitored
var target = $( "#content" )[0];
// Create an observer instance
var observer = new MutationObserver(function( mutations ) {
mutations.forEach(function( mutation ) {
var newNodes = mutation.addedNodes; // DOM NodeList
if( newNodes !== null ) { // If there are new nodes added
var $nodes = $( newNodes ); // jQuery set
$nodes.each(function() {
#!/bin/bash
# INFO=$(xwininfo -frame)
# WIN_GEO="--width="
# WIN_GEO="$WIN_GEO$(echo $INFO | grep -oEe 'geometry [0-9]+x[0-9]+' | grep -oEe '[0-9]+x[0-9]+' | grep -oEe '[0-9]+x[0-9]+')"
# WIN_XY="--x="
# WIN_XY="$WIN_XY$(echo $INFO | grep -oEe 'Corners:\s+\+[0-9]+\+[0-9]+' | grep -oEe '[0-9]+\+[0-9]+' | sed -e 's/+/ --y=/' )"
# WIN_HEI=`echo $WIN_GEO | sed s/x/\\ --height=/g`
XWININFO=$(xwininfo)
read X < <(awk -F: '/Absolute upper-left X/{print $2}' <<< "$XWININFO")
// ==UserScript==
// @name Stash PR links for commits
// @namespace https://gist.githubusercontent.com/hsingh23/67528e4193cf84cad3f1/raw/stash-pullrequest-linker.user.js
// @version 1.0.9
// @downloadURL https://gist.githubusercontent.com/hsingh23/67528e4193cf84cad3f1/raw/stash-pullrequest-linker.user.js
// @updateURL https://gist.githubusercontent.com/hsingh23/67528e4193cf84cad3f1/raw/stash-pullrequest-linker.user.js
// @description Stash's commit view does not show you which pull request a commit belongs to. This script links it up as best as it can.
// @author Harsh Singh
// @match https://*/projects/*/repos/*/commits*
// @match http://*/projects/*/repos/*/commits*
fb = {
group: {
groupGuid: {
name: "name",
timezone: someTimezone,
owners: {
accountGuid: true,
}
}
},
Flows:
create group:
1. get timezone, default alert time
2. create chore group
get group:
sign up with email password:
1. create user
@hsingh23
hsingh23 / .zshrc
Created July 17, 2016 16:59
Harsh's oh my zsh like zplug zshrc
# Check if zplug is installed
if [[ ! -d ~/.zplug ]]; then
git clone https://github.com/zplug/zplug ~/.zplug
source ~/.zplug/init.zsh && zplug update --self
fi
# Essential
source ~/.zplug/init.zsh
# Make sure to use double quotes to prevent shell expansion
@hsingh23
hsingh23 / apt-fast.conf
Created July 17, 2016 17:34
/etc/apt-fast.conf
###################################################################
# CONFIGURATION OPTIONS
###################################################################
# Every item has a default value besides MIRRORS (which is unset).
# Use aptitude or apt-get?
# Note that for outputting the package URI list, we always use apt-get
# ...since aptitude can't do this
# Optionally add the FULLPATH to apt-get or apt-rpm or aptitude
# e.g. /usr/bin/aptitude
@hsingh23
hsingh23 / index.js
Last active December 30, 2016 19:01
async await example sync example (node only)
var async = require('asyncawait/async');
var await = require('asyncawait/await');
console.log("starting")
var getSomethingAsync = function(i){
return new Promise((resolve, reject) => {
setTimeout(()=>resolve(`money = ${i}`), Math.random()*500)
})
}
var foo = async(function() {