Skip to content

Instantly share code, notes, and snippets.

@theepicsnail
theepicsnail / WeechatOTR.md
Last active February 5, 2016 20:53
Install weechat, and otr for weechat.
sudo apt-get install weechat python-pip python-dev
sudo pip install virtualenv
virtualenv -p `which python2.7` .weechatenv
source .weechatenv/bin/activate
pip install python-potr
alias weechat="source ~/.weechatenv/bin/activate; weechat-curses; deactivate"

in weechat then do

@theepicsnail
theepicsnail / watch.sh
Created January 16, 2015 21:58
Monitor files, rerun script when they are modified
#!/bin/bash
# find --
split="-1"
for (( i = 0; i < ${#@}; i++ )); do
if [ "${!i}" == "--" ]
then
split=$i
i=${#@}
fi
done
@theepicsnail
theepicsnail / flux2.py
Created August 24, 2014 00:20
Flux2 solver
import subprocess
#figure this stuff out automatically?
left,top = 58, 478
right,bottom = 1020, 1440
cell_size = 186
height = (bottom - top)
width = (right - left)
gap = (width % cell_size)/(width/cell_size - 1)
import subprocess
#figure this stuff out automatically?
left,top = 58, 478
right,bottom = 1020, 1440
cell_size = 186
height = (bottom - top)
width = (right - left)
gap = (width % cell_size)/(width/cell_size - 1)
alias watch="bash ~/watch.sh"
# watch foo.js bar.js -- ./runTests.sh
# runs runTests.sh, then waits for foo.js or bar.js to be modiified
# then reruns runTests.sh (kills the old process if it's still alive)
@theepicsnail
theepicsnail / glass.html
Created May 3, 2014 04:57
[wearscript] Speed reader
<html style="width:100%; height:100%; overflow:hidden">
<head>
<!-- You can include external scripts here like so... -->
<!--<script src="https://cdnjs.cloudflare.com/ajax/libs/zepto/1.0/zepto.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.5.2/underscore-min.js"></script>-->
</head>
<body style="width:100%; height:100%; overflow:hidden; margin:0" bgcolor="#000">
<canvas id="canvas" width="640" height="360" style="display:block"></canvas>
<script>
var words_per_minute = 300
@theepicsnail
theepicsnail / glass.html
Created April 29, 2014 20:38
[wearscript] Slide show example
<html style="width:100%; height:100%; overflow:hidden">
<head>
<!-- You can include external scripts here like so... -->
<!--<script src="https://cdnjs.cloudflare.com/ajax/libs/zepto/1.0/zepto.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.5.2/underscore-min.js"></script>-->
</head>
<body style="width:100%; height:100%; overflow:hidden; margin:0" bgcolor="#000">
<canvas id="canvas" width="640" height="360" style="display:block"></canvas>
<script>
var words_per_minute = 300
@theepicsnail
theepicsnail / glass.html
Created March 28, 2014 05:43
[wearscript] Multi device attempt
<html style="width:100%; height:100%; overflow:hidden">
<head>
<!-- You can include external scripts here like so... -->
<!--<script src="https://cdnjs.cloudflare.com/ajax/libs/zepto/1.0/zepto.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.5.2/underscore-min.js"></script>-->
</head>
<body style="width:100%; height:100%; overflow:hidden; margin:0">
<canvas id="canvas" width="640" height="360" style="display:block"></canvas>
<script>
function server() {
### Keybase proof
I hereby claim:
* I am theepicsnail on github.
* I am theepicsnail (https://keybase.io/theepicsnail) on keybase.
* I have a public key whose fingerprint is FA28 EB5B BC2C 77CE A838 612D FC6E 54FC 9668 47E1
To claim this, I am signing this object:
import rg, random
def toward((sr, sc), (tr, tc)):
"""Less dumb towards function
returns a position that is 1 step from (s)ource
towards (t)arget.
"""
#Delta row/col
dr = tr - sr
dc = tc - sc