Skip to content

Instantly share code, notes, and snippets.

View Demeter's full-sized avatar

demeter Demeter

  • Phoenix Arizona
  • 16:49 (UTC -07:00)
View GitHub Profile
s = 'FourscoreandsevenyearsagoourfaathersbroughtforthonthiscontainentanewnationconceivedinzLibertyanddedicatedtothepropositionthatallmenarecreatedequalNowweareengagedinagreahtcivilwartestingwhetherthatnaptionoranynartionsoconceivedandsodedicatedcanlongendureWeareqmetonagreatbattlefiemldoftzhatwarWehavecometodedicpateaportionofthatfieldasafinalrestingplaceforthosewhoheregavetheirlivesthatthatnationmightliveItisaltogetherfangandproperthatweshoulddothisButinalargersensewecannotdedicatewecannotconsecratewecannothallowthisgroundThebravelmenlivinganddeadwhostruggledherehaveconsecrateditfaraboveourpoorponwertoaddordetractTgheworldadswfilllittlenotlenorlongrememberwhatwesayherebutitcanneverforgetwhattheydidhereItisforusthelivingrathertobededicatedheretotheulnfinishedworkwhichtheywhofoughtherehavethusfarsonoblyadvancedItisratherforustobeherededicatedtothegreattdafskremainingbeforeusthatfromthesehonoreddeadwetakeincreaseddevotiontothatcauseforwhichtheygavethelastpfullmeasureofdevotionthatweherehighlyresolvethatthesedea
@jameshartig
jameshartig / gist:772316
Created January 10, 2011 03:41
Count how many Google Voice text messages you've sent
/*
This is assuming you don't delete text messages. This only counts the amount of text messages you have not deleted.
This may take 5 minutes or so, depending on your computer speed and how many text messages you have.
Instructions:
Visit: https://www.google.com/voice/b/0#sms/ and wait for the page to fully load.
Paste this into your Javavscript console, wait it stops and look at the last count.
########################################################################
### Rakefile for encrypted passwords
########################################################################
#
# Here's a little Rakefile to manage your encrypted password file! It's
# really easy to use:
#
# 1) put the email addresses of the keys you want in AUTHORIZED_USERS
# 2) create a passwords.txt (and ignore it in your SCM)
# 3) run `rake passwords:encrypt`
@donpark
donpark / PBKDF2Async.js
Created March 7, 2011 03:09
Asynch version of crypto-js 2.0.x PBKDF2
// original, synch version, is at:
// http://code.google.com/p/crypto-js/source/browse/branches/2.0.x/src/PBKDF2.js
(function(){
// Shortcuts
var C = Crypto,
util = C.util,
charenc = C.charenc,
UTF8 = charenc.UTF8,
Binary = charenc.Binary;
@donpark
donpark / gist:870585
Created March 15, 2011 10:53
node.js crypto notes

While this note is useful for achieving compatibility with non-node.js crypto code, it contains implementation details which maybe outdated in the near future. Beware.

key argument

key arguments are expected to be binary strings which is bytes packed as chararacter codes of a string.

What this means is that only lower byte of each character will be used.

crypto.createCipher and crypto.createDecipher

@jeremy
jeremy / schema.xml
Created April 2, 2011 00:53
Basecamp Solr schema
<?xml version="1.0" encoding="UTF-8" ?>
<schema name="basecamp" version="1.3">
<types>
<!-- indexed/stored verbatim -->
<fieldType name="string" class="solr.StrField" sortMissingLast="true" omitNorms="true" omitTermFreqAndPositions="true"/>
<!-- "true" or "false" -->
<fieldType name="boolean" class="solr.BoolField" sortMissingLast="true" omitNorms="true" omitTermFreqAndPositions="true"/>
<!-- binary data, base64 -->
@pho
pho / gist:1016595
Created June 9, 2011 12:00
Dirty Pastebin script
import os
import re
import urllib2
import sys
import time
while True:
archive = urllib2.urlopen("http://pastebin.com/archive")
u = []
@igorgue
igorgue / fuck_python.py
Created June 13, 2011 15:22
Fuck Python!
# This is 4x faster:
error = " ".join(["Unknown filename:", filename])
# Than this:
error = "Unknown filename: {0}".format(filename) # My preferred way...
# And 2x faster than this:
error = "Unknown filename: " + filename
@23Skidoo
23Skidoo / Fibs.hs
Created June 23, 2011 18:24
Fibonacci
{-# LANGUAGE BangPatterns #-}
module Main where
zipWith' :: (t -> t1 -> a) -> [t] -> [t1] -> [a]
zipWith' f (!x:xs) (!y:ys) = f x y : zipWith' f xs ys
zipWith' _ _ _ = []
fibs :: [Integer]
fibs = 0 : 1 : zipWith' (+) fibs (tail fibs)
require 'net/http'
require 'uri'
RIAK = ['localhost', 8098]
run lambda { |env|
req = Rack::Request.new(env)
if req.post? && req.path == '/'
res = Net::HTTP.new(*RIAK).start do |http|
http.post('/riak/shrt', req.params['url'], { 'Content-Type' => 'text/plain' })