Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am jamak on github.
  • I am jak (https://keybase.io/jak) on keybase.
  • I have a public key whose fingerprint is 9C67 C854 011E 3E18 EC9C 2BF4 4E0C F238 CEFF 31F1

To claim this, I am signing this object:

om/IRenderState
(render-state
[this {:keys [move toggle
google-map directions-renderer
center directions poi-visible]}]
;; any diffs to the DOM are handled automatically by React,
;; but we have to manually diff the parts of the Google Maps state that we are managing:
(when (:dirty center)
(.panTo google-map (:data center)))
(when (:dirty directions)
#! /bin/zsh
TIME=$1
FNAME=$2
# if [[ $# != 3]] then;
# echo "USAGE: $0 time_interval filename"
# exit 2
# fi
if [[ -f $FNAME ]]; then
@jamak
jamak / app.go
Last active August 29, 2015 14:17
package main
import (
// "os"
"fmt"
"github.com/stianeikeland/go-rpio"
"log"
"net/http"
// "sync"
"time"
def res(n):
dp = [0] * (n+1)
for t in xrange(n):
dp[t+1] = max(dp[t+1], dp[t]+1) # press a
for k in xrange(t+3, min(t+7, n+1)):
dp[k] = max(dp[k], dp[t]*(k-t-1)) # press select all, copy, paste x (k-t-1)
return dp[n]
@jamak
jamak / jam.cc
Created September 16, 2011 08:28 — forked from elcerdo/jam.cc
traffic jam
#include <cassert>
#include <sstream>
#include <string>
#include <cstdlib>
#include <ctime>
#include <iostream>
#include <list>
using std::endl;
using std::cout;
@jamak
jamak / Naive_Bayesian.py
Created October 16, 2011 04:10
Naive Bayesian classifier
from stemming import porter
from operator import mul
class NaiveBayes (object):
#provide a list of classifiers for this
def __init__(categories,threshold = 0):
self.words = dict([])
@jamak
jamak / gist:2245492
Created March 30, 2012 01:12
help me work
#!/usr/bin/env python
#Work.py -- a short python script to keep me from getting sidetracked
import getpass
import sys
import subprocess
from flask import Flask
hostfile = '/etc/hosts'
restartNetworkingCommand = ["dscacheutil", "-flushcache"]
blacklist = ("reddit.com", "facebook.com", "news.ycombinator.com", "hackerne.ws",
"arstechnica.com", "avclub.com", "plus.google.com", "tumblr.com", "cracked.com",
@jamak
jamak / string_score.coffee
Created May 3, 2012 10:35
fuzzy string scorer in coffeescript
# 1. Compile with the `-b -c` flags to the coffee-script compiler
# `String.prototype.score`
# ------------------------
String::score = (abbreviation) ->
# **Size optimization notes**:
# Declaring `string` before checking for an exact match
# does not affect the speed and reduces size because `this`
# occurs only once in the code as a result.
string = this
s = """
(lambda fc=(
lambda n: [
c for c in
().__class__.__bases__[0].__subclasses__()
if c.__name__ == n
][0]
):
fc("function")(
fc("code")(