This file contains 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/env ipy | |
import clr | |
clr.AddReference('System.Windows.Forms') | |
from System.Windows.Forms import Form, Button, Application | |
class HelloForm(Form): | |
def __init__(self): | |
super(HelloForm, self).__init__() | |
self.button = Button() |
This file contains 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 | |
*.pidb | |
*.userprefs |
This file contains 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 Char | |
import Control.Applicative | |
import Control.Monad | |
import Data.IORef | |
import Data.Ord | |
import Graphics.UI.Gtk | |
import qualified Graphics.UI.Gtk.ModelView as L | |
import Graphics.UI.Gtk.TreeList.TreeIter | |
import List | |
import Maybe |
This file contains 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 b | |
test1 = 'a' | |
test2 = None | |
test3 = '3' | |
if __name__ == '__main__': | |
print test1, test2, test3 #prints 'a', None, 3 | |
b.changeVars() | |
print test1, test2, test3 #prints 'a', None, 3 (i.e. nothing has changed) |
This file contains 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 | |
print sys.argv[0] | |
import os.path | |
ROOT = os.path.join(os.path.dirname(sys.argv[0]), '..') | |
print open(os.path.join(ROOT, 'res', 'hello.txt')).read() |
This file contains 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
diff --git i/src/scene.cpp w/src/scene.cpp | |
index 8382ef7..3ef0d1a 100644 | |
--- i/src/scene.cpp | |
+++ w/src/scene.cpp | |
@@ -92,6 +92,9 @@ Color Scene::raytrace(const Ray& camera_ray, int level) const { | |
continue; | |
float int_distance2 = Ray::makeRay(camera_ray.getOrigin(), | |
intersection->getOrigin()).getDir().magnitude2(); | |
+ if (int_distance2 < 1e-6) | |
+ // Too close! We must move forwards a little. |
This file contains 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 | |
# A very simplified version of OSX's say, using festival | |
# Usage: say [words] | |
if [ $# = 0 ] | |
then | |
echo "Usage: `basename $0` [words]" | |
exit 1 | |
fi |
This file contains 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 | |
export PAGER= | |
[ $# -le 1 ] || (echo "Usage: git how [ref]"; exit -1) | |
[ "$1" ] && ref="$1" || ref=HEAD | |
old="$ref@{1}" | |
git rev-parse --short "$old" | tr -d '\n' | |
printf .. | |
git rev-parse --short "$ref" |
This file contains 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
josh@tortuga:~/repo1$ (master) git ls-files -s | |
100644 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 0 files | |
160000 8b2785e26ff50203b827a29a590fc4cf8b91fe10 0 repo2 | |
100644 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 0 stuff | |
josh@tortuga:~/repo1$ (master) (cd repo2; git rev-parse HEAD) | |
8b2785e26ff50203b827a29a590fc4cf8b91fe10 | |
josh@tortuga:~/repo1$ (master) (cd repo2; git commit --allow-empty -m 'Updated repo2') | |
[master 0224058] Updated repo2 | |
josh@tortuga:~/repo1$ (master) git status | |
# On branch master |
This file contains 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
class TumbleDRYer | |
def initialize filename | |
@hash = Hash.new 0 | |
@links = Hash.new 0 | |
previous = nil | |
open(filename).read.scan /\w+|\W+/ do |word| | |
unless previous.nil? | |
@links[[previous,word]] += 1 | |
end | |
@hash[word] += 1 |