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
# some test data | |
cell1 = { | |
"cell_type": "code", | |
"collapsed": False, | |
"input": [ | |
"x", | |
"x", | |
"x", | |
"x", |
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
// ==UserScript== | |
// @match https://my.concordia.ca/* | |
// ==/UserScript== | |
// Prevent MyConcordia from logging you out every X minutes UGHGHGHGHGH | |
// by refreshing the page every five minutes. | |
setTimeout(function () { | |
location.href = location.href; | |
}, 1000 * 60 * 5); |
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/env bash | |
LAST_COMMIT_FILES=$( git log -1 --numstat --pretty="%h" | tail -n +3 | awk '{print $3}' ); | |
vim -p $LAST_COMMIT_FILES |
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/env bash | |
MODDED_FILES=$( git ls-files --modified ); | |
vim -p $MODDED_FILES |
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
# Most General Unifier implementation | |
# - Tavish Armstrong | |
class Pred(object): | |
def __init__(self, name, args): | |
self.name = name | |
self.args = args | |
def apply(self, sub): |
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 lib2to3.pygram | |
import lib2to3.pgen2.driver as driver | |
class Tree(object): | |
def __init__(self, n): | |
self.n = n | |
self.used_names = set() | |
def __getitem__(self, idx): |
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
# Tavish Armstrong (c) 2013 | |
# | |
# make_merge_conflict.py | |
# | |
# Make a new directory, initialize a git repository within, and cause a merge conflict. | |
# Yes. On purpose. | |
import os | |
import subprocess | |
import random |
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/env bash | |
while [ 1 ]; | |
do | |
cp ~/test.txt ~/test.txt.old | |
EVENT=$(inotifywait --format '%e' ~/test.txt); | |
[ $? != 0 ] && exit | |
[ "$EVENT" = "MODIFY" ] && echo 'file modified!' | |
diff ~/test.txt ~/test.txt.old | |
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
# two strings | |
A = 'abcabba' | |
B = 'cbabac' | |
# Get a list of columns and their truth values. | |
[[a == b for (a, b) in list(it.product(A, B))][i*6:i*6+6] for i in range(len("abcabba"))] | |
""" | |
expected_result = [[False, False, True, False, True, False], | |
[False, True, False, True, False, False], |
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
from flask import Flask | |
class NBDiffFlask(Flask): | |
def set_files(self, file1, file2): | |
self.file1 = file1 | |
self.file2 = file2 | |
app = NBDiffFlask(__name__) | |
@app.route("/diff.js") |
NewerOlder