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
-- Facebook puzzle #1 - Hors d'oeuvres | |
-- http://www.facebook.com/careers/puzzles.php?puzzle_id=7 | |
output 0 = return () | |
output x = | |
putStrLn (gethop x) | |
output (x - 1) | |
gethop x | |
| div3 x && div5 x = "Hop\n" |
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
awk 'length($1) > length($2) {tmp = $2; $2 = $1; $1 = tmp} {print $0}' input.log > output.log |
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 self.parse_ip(ip) | |
ip.split('.').collect(&:to_i).inject { |memo,x| x + (memo << 0x1) } | |
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
find . -size 0k -exec rm {} \; |
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
sed -E '/^.$/d' |
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
nmap <D-Up> :tabnew<CR> | |
nmap <D-Right> :tabnext<CR> | |
nmap <D-Left> :tabprevious<CR> | |
nmap <D-Down> :tabclose<CR> |
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
grep -oP "Completed 200 OK in (\d+)ms" log/production.log | grep -oP "\d+" | |
# or, any request that spends at least 1ms on MassiveRecord: | |
cat log/production.log | grep -P "Completed 200 OK in (\d+)ms \(Views: \d+.\d+ms \| MassiveRecord: [1-9][0-9]?.\d+ms\)" | grep -oP "in \d+ms" | grep -oP "\d+" > ~/timings1.log |
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
java.math.BigInteger.new(java.lang.String.new("\x00\x00\x00\x00\x00\x00\x00\x10").getBytes()).longValue() |
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
git log -p -SmyCode -- . | grep -A20 "^\-.*myCode.*$" | cut -c 2- |
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
public static String camelToSnakeCase(String camelCased) { | |
def snakeCased = new StringBuilder() | |
for (char c : camelCased) { | |
if (c.isUpperCase()) { | |
snakeCased.append('_') | |
} | |
snakeCased.append(c.toLowerCase()) | |
} |
OlderNewer