Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 python3 | |
from Crypto.Cipher import AES | |
import hashlib | |
import sys | |
import argparse | |
import getpass | |
parser = argparse.ArgumentParser() | |
parser.add_argument("filepath", help="journal file to decrypt") |
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
mcinspect delete $(mcinspect list | grep <substring> | awk -F'|' '{ print $4 }') |
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 datetime import datetime | |
import fileinput | |
start = datetime.now() | |
L = [] | |
for line in fileinput.input(): | |
L.append(int(line)) | |
print 'time to read 8000000 ints into list using append: ', datetime.now() - start |
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 | |
find $1 -type f -print0 | xargs -0 stat -f'%z' | awk '{b+=$1} END {print b}' | awk '{ sum=$1 ; hum[1024**3]="GB";hum[1024**2]="MB";hum[1024]="KB"; for (x=1024**3; x>=1024; x/=1024){ if (sum>=x) { printf "%.2f %s\n",sum/x,hum[x];break } }}' |
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 simulate() { | |
var theCanvas = document.getElementById("the-canvas"); | |
var theContext = theCanvas.getContext('2d'); | |
theContext.translate(theCanvas.width / 2, theCanvas.height / 2); | |
var radius = 60; | |
var amplitude = theCanvas.height / 2 - radius - 10; | |
var sinBall = { | |
x: 0, |
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
/* | |
How many ways can the set of numbers from 1 to N be partitioned into two | |
subsets in such a way that the sum of both subsets is equal? | |
Hint 1. For each partitioning, the sum of each subset will be the same value | |
Hint 2. This value is the sum from 1 to N divided by 2. (N * (N + 1) / 2) / 2 | |
Hint 3. The problem has been reduced to, "How many subsets of a given set sum | |
to a specific value?". Note that once we have this number of subsets, we |
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
''' | |
How many ways can the set of numbers from 1 to N be partitioned into two | |
subsets in such a way that the sum of both subsets is equal? | |
Hint 1. For each partitioning, the sum of each subset will be the same value | |
Hint 2. This value is the sum from 1 to N divided by 2. (N * (N + 1) / 2) / 2 | |
Hint 3. The problem has been reduced to, "How many subsets of a given set sum | |
to a specific value?". Note that once we have this number of subsets, we |
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
CC = gcc | |
CFLAGS = -Wall -O3 --std=c11 | |
CDEBUGFLAGS = -Wall -O0 --std=c11 -g | |
wwd: main.c | |
$(CC) $(CFLAGS) -o $@ $< |
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/bash | |
wget_floss_n () { | |
floss_number=$(printf "%04d\n" $1) | |
wget -nc http://www.podtrac.com/pts/redirect.mp3/twit.cachefly.net/audio/floss/floss$floss_number/floss$floss_number.mp3 | |
} | |
latest_show=$(wget http://twit.tv/show/floss-weekly -O - | grep "show-title" | egrep -o "\d+" | sort -ru | head -n 1) | |
for n in $(seq $latest_show -1 1) |