Skip to content

Instantly share code, notes, and snippets.

View jkakar's full-sized avatar

Jamu Kakar jkakar

View GitHub Profile
# If not running interactively, don't do anything
[ -z "$PS1" ] && return
# don't put duplicate lines in the history. See bash(1) for more options
# ... or force ignoredups and ignorespace
HISTCONTROL=ignoreboth
# append to the history file, don't overwrite it
shopt -s histappend
-- Don't rollback the entire transaction if you typo a SQL query when
-- in interactive mode.
\set ON_ERROR_ROLLBACK interactive
-- Show query timing information.
\timing
-- Include transaction information in the prompt.
\set PROMPT1 '%[%033[33;1m%]%x%[%033[0m%]%[%033[1m%]%/%[%033[0m%]%R%# '
package main
import (
"bufio"
"fmt"
"log"
"net/http"
"os"
"strings"
"time"
@jkakar
jkakar / .gitconfig
Last active December 25, 2015 20:39
[alias]
cleanbranches = !/Users/jkakar/bin/gitcleanbranches.sh
@jkakar
jkakar / gitcleanbranches.sh
Created July 18, 2012 23:45
Deleting merged branches with Git
#!/bin/bash
set -x
# Update the master branch.
git checkout master
git pull upstream master
# Synchronize the remote repository.
git push origin master
.emacs:
(when (load "flymake" t)
(defun flymake-pyflakes-init ()
(let* ((temp-file (flymake-init-create-temp-buffer-copy
'flymake-create-temp-inplace))
(local-file (file-relative-name
temp-file
(file-name-directory buffer-file-name))))
(list "/home/jkakar/.emacs.d/plugins/epylint.py" (list local-file))))
// URI encode some text.
Handlebars.registerHelper('encode', function(property) {
var text = Ember.getPath(this, property);
return encodeURIComponent(text);
});
class Thingy(Storm):
id = Int(...)
_cache = {}
def getValue(self):
if 'value' in self._cache:
return self._cache['value']
else:
# Load value from the database and cache it.
@jkakar
jkakar / gist:2008836
Created March 9, 2012 21:38
GET /values response with new 'updated-at' data
HTTP/1.1 200 OK
Content-Length: 817
Date: Mon, 02 Aug 2010 13:14:32 GMT
Content-Type: application/json
{
"results" : {
"id" : {
"05eee31e-fbd1-43cc-9500-0469707a9bc3" : {
"fluiddb/about" : {