Skip to content

Instantly share code, notes, and snippets.

Sai Teja Suram dotslash

Block or report user

Report or block dotslash

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View exp_wait_for_perm.py
# Usage:
# > python exp_wait_for_perm.py 12
# > python exp_wait_for_perm.py 3
# Needs - numpy
from numpy.random import seed
from numpy.random import randint
from collections import defaultdict as ddict
import sys
import time
View SnapshottableArray.scala
import scala.collection.mutable.ListBuffer
trait SnapshottableArray {
// Regular array operations
def set(index: Int, value: Int): Unit
def get(index: Int): Int
// Creates a snapshot and returns a handle to the snapshot
def snapshot(): Int
View python_util.py
default_date_format = "";
def now():
pass
def ts_to_dt():
pass
def dt_to_string(dt, format=default_date_format):
pass
@dotslash
dotslash / hist_to_db.py
Created Nov 9, 2016 — forked from pklaus/hist_to_db.py
Store your Bash history in an SQLite database with this Python script.
View hist_to_db.py
#!/usr/bin/env python
# -*- encoding: UTF8 -*-
""" Store all entered bash commands ('the history') in a database
http://blog.philippklaus.de/2015/04/enhancing-and-enlarging-the-bash-history/
"""
import sqlite3
from os import path, makedirs
import sys
View emojis.json
[
{
"keywords":[
"face",
"grin"
],
"code":"U+1F600",
"name":"grinning face",
"emoji":"😀"
},
View main.py
from sklearn.preprocessing import LabelEncoder
from sklearn.cross_validation import train_test_split
import json
import re
import time
import sys
import scipy.sparse as sparse
from sklearn.ensemble import GradientBoostingClassifier, RandomForestClassifier
from sklearn.naive_bayes import MultinomialNB
from sklearn.linear_model import SGDClassifier
View .vimrc
" ===============VUNDLE============
set nocompatible " be iMproved, required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')
" let Vundle manage Vundle, required
@dotslash
dotslash / twitter-disclaimer.md
Last active Jul 27, 2016
Twitter disclaimer - yesteapea
View twitter-disclaimer.md
@dotslash
dotslash / rec-stack.py
Created Apr 15, 2016
Examples for my post on converting recursion to stack
View rec-stack.py
def hanoi(n, fr, to, buf):
if (n == 0):
return
#print "deb", 'l', n, fr, to, buf
hanoi(n-1, fr, buf, to)
#print "deb", 'r', n, fr, to, buf
print "{} {}->{}".format(n, fr, to)
hanoi(n-1, buf, to, fr)
def hanoi_iter(n, fr, to, buf):
You can’t perform that action at this time.