Skip to content

Instantly share code, notes, and snippets.

View jimmybot's full-sized avatar

James Lee jimmybot

View GitHub Profile
@jimmybot
jimmybot / script.py
Last active July 13, 2018 08:14
Running Python scripts using the Python interpreter dynamically from the local virtual env rather than hardcoding a full path
#!/bin/sh
"exec" "`dirname $0`/python" "$0" "$@"
"exit $?"
print('hello from my double entendre script!')
print('a python script that runs as both sh that then runs the same script as sh')
raise Exception("things didn't go well: check my exit code is 1")
"\e[B": history-search-forward
"\e[A": history-search-backward
"\e[C": forward-char
"\e[D": backward-char
"\e[1;6D": backward-word
"\e[1;6C": forward-word
set show-all-if-ambiguous on
# ` is an interesting key for a prefix
set-option -g prefix `
set -g window-status-bg yellow
# we need literal ` sometimes, allow switching
# we can also send the prefix char with `-a
bind-key C-b set-option -g prefix C-b
bind-key C-v set-option -g prefix `
bind-key ` last-window
"use strict";
/*
const duplexer2 = require('duplexer2')
const {Readable, Writable} = require('stream')
*/
const duplexer = require('duplexer2')
const child_process = require('child_process')
select * from keyword_campaigns where campaign_id = 1205;
select * from keyword_campaigns where keyword = 'halloween';
import random
import sqlite3
conn = sqlite3.connect('btreedemo.sqlite')
c = conn.cursor()
c.execute('''DROP TABLE IF EXISTS keyword_campaigns''')
c.execute('''CREATE TABLE keyword_campaigns
(keyword, campaign_id, budget, spent, primary key(keyword, campaign_id)) without rowid''')
def logger(fn):
start = time()
fn()
end = time()
print("time taken was: ", end - start)
return inner
"use strict";
function* aGenerator() {
throw new Error("rarg")
}
function runner() {
var gen = aGenerator()
gen.next()
}
@jimmybot
jimmybot / .tmux.conf
Last active September 22, 2015 18:17
# ` is an interesting key for a prefix
set-option -g prefix `
set -g window-status-bg yellow
# we need literal ` sometimes, allow switching
# we can also send the prefix char with `-a
bind-key C-b set-option -g prefix C-b
bind-key C-v set-option -g prefix `
bind-key ` last-window