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
ag fofo |
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
miles@attercop:~/code/taksman$ tree tasks | |
tasks | |
├── done | |
│ └── foo | |
├── entry | |
│ ├── 033-dns | |
│ ├── 033-reading | |
│ ├── 115-cable | |
│ ├── 115-lab1 | |
│ ├── 115-locker |
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 python | |
import sys | |
import subprocess | |
import netifaces | |
if __name__ == "__main__": | |
ipv4 = netifaces.ifaddresses('wlan0')[netifaces.AF_INET][0]['addr'] | |
print ipv4 | |
if len(sys.argv) > 1: | |
subprocess.Popen(["sm", "-f", "#000", "-b", "#DDD", " {} ".format(ipv4)]) |
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
// function interceptor | |
var interceptMethod = function(object, methodName, newMethodGen) { | |
previousMethod = object[methodName] | |
object[methodName] = newMethodGen(previousMethod) | |
} | |
// where newMethodGen is of the form | |
foo = {x: function() {console.log('foo.x')}} | |
interceptMethod(foo, 'x', function(f) { |
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
object SententialCalculus { | |
// Here is a scala program which classifies an SC sentence. | |
// It recognizes whether the sentence is an SC sentence, | |
// and returns the parsed typed tree. | |
// You can run this with the following command, but here's | |
// an executive summary. | |
// fsc -d build classifier.scala && scala -classpath build SententialCalculus | |
// Executive summary: | |
// If the input is a single predicate atom, this is an atom. | |
// If the input starts with a NOT, this is a negation. |
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
from lib601.sm import * | |
def LTISM(cCoeffs, dCoeffs): | |
def parallelAddMany(machines): | |
return reduce(lambda a,b: ParallelAdd(a,b), machines, Gain(0)) | |
def CascadeMany(machines): | |
return reduce(lambda a,b: Cascade(a,b), machines, Gain(1)) | |
def RPower(power): |
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 this | |
import string | |
print '\n'.join([''.join([(this.d[c] if c in string.letters else c) for c in line]) for line in this.s.split('\n')]) |
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
def f(x, y, z): | |
print x + y | |
print z | |
def f(int x, int y, string z): | |
print x + y | |
print z | |
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
# pre-apply this to an object's method definition to make it return the | |
# context and thus be chainable. | |
# example: | |
# class FOO | |
# addThing: make_chainable (e) -> @stuff.push e | |
make_chainable = (f) -> -> | |
f.apply this, arguments | |
this |
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
# (written for edX) | |
# Helper class for managing the execution of interval tasks. | |
# Handles pausing and restarting. | |
class IntervalManager | |
# Create a manager which will call `fn` | |
# after a call to .start every `ms` milliseconds. | |
constructor: (@ms, @fn) -> | |
@intervalID = null | |
# Start or restart firing every `ms` milliseconds. |