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/bash | |
# Script to reply to your own previous tweet. Useful for those long | |
# conversations we know you like to have with yourself. | |
last_tweet_id=$(twidge lsarchive -l | head -1 | cut -f 1) | |
twidge update -i $last_tweet_id |
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
% Download intersections.m from http://www.mathworks.com/matlabcentral/fileexchange/11837-fast-and-robust-curve-intersections | |
% and put it in a folder on your MATLAB path. Put this function on your path too. | |
function [xi, yi] = polyxpoly(x1, y1, x2, y2) | |
[xi, yi] = intersections(x1, y1, x2, y2); | |
end |
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
print """Sample tree: | |
_1_ | |
/ | \\ | |
2 3 4 | |
/ \\ \\ | |
5 6 7 | |
/ \\ \\ | |
8 9 10 | |
""" |
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/bash | |
# Start the VM with `./vm start` (to boot from disk) or `./vm livecd` (to boot | |
# from installation media). Once openssh starts on the VM, the QEMU console will | |
# display something like: | |
# | |
# Local packages (start): sshd Starting sshd. done. | |
# | |
# Now you can ssh to the VM from your host machine with `./vm ssh`. | |
# | |
# To kill the VM, run `./vm kill`. This might do something surprising and |
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
var fs = require('fs'); | |
function go() { | |
fs.readFile('./unused.txt', function(err, data) { | |
if (err) throw err; | |
var items = data.toString().split('\n'); | |
var index = Math.floor(Math.random()*items.length); | |
var item = items[index]; | |
items.splice(index, 1); | |
console.log(item); |
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 | |
# The alias to call this script needs to source it, not just execute it in a | |
# new shell, or you'll make the directory but not cd to it in the parent shell. | |
# Like this: alias mcd='source ~/.scripts/mkdir_and_cd.sh' | |
if [ "$#" -ne 1 ]; then | |
echo "Please pass exactly one directory name." | |
else | |
mkdir "$1" | |
cd "$1" |
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 thuemorse(n): | |
b = { "0": "1", "1": "0" } | |
s = "0" | |
print "0\t0" | |
for i in range(1, n+1): | |
print "{}\t".format(i), | |
s += ''.join([b[x] for x in s]) | |
print s | |
if __name__ == '__main__': |
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 | |
# Generate random passwords. Usage: `./generate-password.sh [quantity [length]]` | |
case "$#" in | |
0) | |
QUANTITY=1 | |
LENGTH=32 | |
;; | |
1) | |
QUANTITY="$1" |
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 datetime, sys | |
today = datetime.date.today() | |
month = today.month | |
year = today.year | |
if len(sys.argv) == 2: | |
day = int(sys.argv[1]) |
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
module Main | |
where | |
import System.IO | |
main = do | |
num <- getNums | |
putStrLn ("The sum is " ++ show (sum num)) | |
putStrLn ("The product is " ++ show (product num)) | |
putFactorials num |
OlderNewer