Skip to content

Instantly share code, notes, and snippets.

@justmytwospence
justmytwospence / keybase.md
Created Oct 31, 2017
Proof for Keybase.io
View keybase.md

Keybase proof

I hereby claim:

  • I am justmytwospence on github.
  • I am justmytwospence (https://keybase.io/justmytwospence) on keybase.
  • I have a public key ASDemKLHtCcmEFUpeBKZ6vtO8t1wjGMB8ROswxerxovUOAo

To claim this, I am signing this object:

View gist:fca9159be15bf134b2aad9d07da56f95
-modi [string] Enabled modi
combi (XResources)
-opacity [number] Window opacity
80 (XResources)
-width [number] Window width
50 (Default)
-lines [number] Number of lines
15 (Default)
-columns [number] Number of columns
1 (Default)
@justmytwospence
justmytwospence / brutus.py
Last active Aug 29, 2015
Fun brute force Caesar cipher decryptor
View brutus.py
def brute_caesar_decrypt(encrypted):
import string
alphabet = string.ascii_letters
for shift in range(-13, 13):
shifted = alphabet[-shift:] + alphabet[:-shift]
decrypted = ''.join([shifted[alphabet.index(char)] for char in encrypted])
print decrypted.lower()
View mailcomplete.vim
" http://recursivedream.com/blog/2012/auto-completing-google-contacts-in-vim/
" Escape query and handle goobook errors
function! mailcomplete#Complete(findstart, base)
if a:findstart == 1
let line = getline('.')
let idx = col('.')
while idx > 0
let idx -= 1
let c = line[idx]
" break on header and previous email
@justmytwospence
justmytwospence / cache.py
Created Jul 10, 2014
A decorator that "caches" results of an arbitrary function based on its arguments.
View cache.py
def cache(func):
saved = {}
@wraps(func)
def newfunc(*args):
if args in saved:
return newfunc(*args)
result = func(*args)
saved[args] = result
return result
return newfunc
@justmytwospence
justmytwospence / preamble.tex
Created Jul 4, 2014
Basic LaTeX preamble, especially for Rnoweb files.
View preamble.tex
\documentclass{article}
\usepackage{graphicx,hyperref,amsmath,natbib,bm,url} % Common packages
\usepackage[australian]{babel} % Ascending date format
\usepackage[a4paper,text={16.5cm,25.2cm},centering]{geometry} % Document size
\usepackage[compact,small]{titlesec} % Title spacing
\setlength{\parskip}{1.2ex} % Paragraph spacing
\setlength{\parindent}{0em} % Paragraph indentation
\clubpenalty = 10000 % Prevent orphans
\widowpenalty = 10000 % Prevent widows
View sankey.html
<!DOCTYPE html>
<meta charset="utf-8">
<body>
<style>
#chart {
height: 500px;
}
.node rect {
cursor: move;
fill-opacity: .9;
View sankey.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View bar.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>D3 Page Template</title>
<script type="text/javascript" src="d3/d3.js"></script>
<script type="text/javascript" src="d3/lib/colorbrewer/colorbrewer.js"></script>
<style>
rect:active {
fill: 'orange';
@justmytwospence
justmytwospence / contract-optimization.ipynb
Created Mar 14, 2014
Business Strategies for Big Data assignment
View contract-optimization.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.