This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/lua | |
local values = io.read("*number") | |
while values > 0 do | |
local currentguess = 0 | |
for i = 1, values do | |
thisguess = io.read("*number") | |
if thisguess ~= currentguess then |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import matplotlib.pyplot as plt | |
def quickPlot(*args): | |
n = len(args) | |
print n | |
colors = ['r.', 'g.', 'b.', 'c.', 'm.'] | |
num_colors = len(colors) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% Checking claims on the SP 500 | |
current = 1689.42; % August 1st, 2013 | |
% Each entry represents the SP500 on the first day of that month | |
% There are 360 months represented in this file. 1983-08-01 to 2013-07-01 | |
% This data was pulled from Yahoo Finance. | |
fullHistory = [ 1609.78 1631.71 1597.55 1569.18 1514.68 1498.11 1426.19 1416.34 1412.2 1440.9 1406.54 1379.32 1362.33 1309.87 1397.86 1408.47 1365.9 1312.45 1258.86 1246.91 1251 1131.21 1219.12 1292.59 1320.64 1345.2 1365.21 1329.48 1328.64 1289.14 1257.62 1186.6 1185.71 1143.49 1049.72 1107.53 1031.1 1087.3 1188.58 1171.23 1105.36 1073.89 1116.56 1098.89 1036.18 1054.91 1019.52 990.22 920.82 923.26 872.74 793.59 729.57 823.09 902.99 888.61 968.67 1164.17 1287.83 1269.42 1276.69 1399.62 1385.97 1326.41 1330.45 1378.6 1467.97 1479.63 1545.79 1527.29 1473.96 1455.18 1504.66 1530.62 1482.37 1420.83 1406.8 1437.9 1418.03 1400.63 1377.76 1335.82 1303.8 1278.53 1270.06 1270.05 1310.61 1302.88 1280.66 1280.08 1248.29 1249.48 1207.01 1228.81 1220.33 1234.18 1191.33 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import xml.etree.ElementTree as etree | |
def main(): | |
assert len(sys.argv) >= 2 | |
filename = sys.argv[1] | |
# This translates the Google Maps symbol codes | |
# to Garmin symbol codes. I have determined that |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Act like GNU screen | |
unbind C-b | |
set -g prefix C-a | |
bind-key C-a last-window | |
setw -g aggressive-resize on | |
# Reload tmux conf | |
bind-key r source-file ~/.tmux.conf | |
# Look good |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
for i in $(ls -1 $1) | |
do | |
thumb=$(echo $i | sed 's/\./_t./') | |
convert $i -resize 120000@ $thumb | |
done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" .vimrc | |
" James's vim configuration file. | |
" This configuration makes James happy to program. | |
let mapleader=" " | |
set autoindent | |
set backspace=indent,start | |
set nocompatible | |
set expandtab |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import urllib | |
import sys | |
import re | |
troll = "dQw4w9WgXcQ" | |
urlsource = sys.argv[1] | |
f = urllib.urlopen(urlsource) | |
s = f.readlines() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function mandelbrot() | |
% Generates a mandelbrot set image | |
delta = 0.01; | |
xmin = -2.5; | |
xmax = 1; | |
ymin = -1; | |
ymax = 1; | |
colors = char('r.', 'g.', 'b.', 'c.', 'm.'); | |
num_colors = size(colors, 1); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
// This function performs our rounding. | |
// $positiveIntValue - a positive integer value that will be rounded. | |
// $unit - A unit amount of something. 12 inches in a foot. 1000 meters in a kilometer. | |
// $rounder - Determines how the unit is rounded (0.0 means that the value is rounded down, 0.5 means the value is rounded to the nearest unit, and 1.0 means the value is rounded up) | |
function roundUnit($positiveIntValue, $unit, $rounder) { | |
return (int)( (int)($positiveIntValue / $unit + $rounder) * $unit ); | |
} |