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
class Library | |
def self.leaf_paths_of(paths) | |
PathTree.new(paths).reduce | |
end | |
end | |
class PathTree < Hash | |
def initialize(paths = []) | |
paths.each { |path| self << path } | |
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
Pyrit 0.4.0 (C) 2008-2011 Lukas Lueg http://pyrit.googlecode.com | |
This code is distributed under the GNU General Public License v3+ | |
Running benchmark (22176.6 PMKs/s)... \ | |
Computed 22176.60 PMKs/s total. | |
#1: 'OpenCL-Device 'Juniper'': 23084.8 PMKs/s (RTT 2.8) | |
#2: 'CPU-Core (SSE2)': 628.6 PMKs/s (RTT 3.0) |
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
Pyrit 0.4.0 (C) 2008-2011 Lukas Lueg http://pyrit.googlecode.com | |
This code is distributed under the GNU General Public License v3+ | |
Running benchmark (2747.2 PMKs/s)... \ | |
Computed 2747.16 PMKs/s total. | |
#1: 'OpenCL-Device 'GeForce GT 330M'': 1630.3 PMKs/s (RTT 2.6) | |
#2: 'CPU-Core (SSE2)': 458.1 PMKs/s (RTT 3.1) | |
#3: 'CPU-Core (SSE2)': 477.6 PMKs/s (RTT 3.1) | |
#4: 'CPU-Core (SSE2)': 471.0 PMKs/s (RTT 3.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
Number.prototype.toCurrency = -> | |
match = (this / 100).toString().match(/^-?(\d+)(\.\d+)?$/) | |
return unless match | |
cents = if match[2] then (match[2] + '00').substr(1, 2) else '00' | |
dollars = match[1].replace(/(\d)(?=(\d\d\d)+(?!\d))/g, '$1,') | |
result = "$#{dollars}.#{cents}" | |
result = '-' + result if this < 0 |
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
Running benchmark (20114.1 PMKs/s)... - | |
Computed 20114.07 PMKs/s total. | |
#1: 'OpenCL-Device 'Juniper'': 22367.4 PMKs/s (RTT 2.8) | |
#2: 'CPU-Core (SSE2)': 401.4 PMKs/s (RTT 3.3) |
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
require 'csv' | |
# Cheers to Greg on StackOverflow | |
# http://stackoverflow.com/questions/181990/programmatically-access-currency-exchange-rates | |
class Yahoo | |
def self.fetch(code = 'AUDUSD') | |
csv = `curl -q "http://download.finance.yahoo.com/d/quotes.csv?s=#{code}=X&f=sl1d1t1ba&e=.csv"` | |
values = CSV.parse(csv) | |
values[0][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
# Adapted from the momentjs calendar function | |
# Inspired by this answer: http://stackoverflow.com/a/10306813/325676 | |
moment.fn.calendarTitle = -> | |
calendar = | |
sameDay : '[Today]', | |
nextDay : '[Tomorrow]', | |
nextWeek : 'dddd, Do MMM', | |
lastDay : '[Yesterday]', | |
lastWeek : '[Last] dddd', |
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 ruby | |
require 'pry' | |
require 'set' | |
# disk UUID | |
# find with `diskutil corestorage list` | |
UUID = "1D1D6CEB-4613-472C-AE71-BD50651D44D1" | |
SUFFIXES = [ '', '!!', '123' ] | |
JOINS = [ '', ',', ', ' ] |
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
### Keybase proof | |
I hereby claim: | |
* I am captainpete on github. | |
* I am captainpete (https://keybase.io/captainpete) on keybase. | |
* I have a public key whose fingerprint is 108B 0A12 F415 0AC4 EDD7 17AB 16D5 D511 A1ED DA5B | |
To claim this, I am signing this object: |
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
#!/sbin/openrc-run | |
description="infnoise - Feed entropy pool using the Infinite Noise TRNG" | |
pidfile="/var/run/infnoise.pid" | |
command="/usr/local/sbin/infnoise" | |
command_args="--dev-random" | |
start_stop_daemon_args="--make-pidfile --background" | |
depend() { | |
before urandom |