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 frequency-table (atom {})) | |
(defn random-quote [] | |
(slurp "http://www.braveclojure.com/random-quote")) | |
(defn word-frequencies [s] | |
(frequencies (str/split (.toLowerCase s) #"\W+"))) | |
(defn update-frequency-table [] | |
(swap! frequency-table (fn [current-state] (merge-with + current-state (word-frequencies (random-quote)))))) |
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 | |
file="$1" | |
key_id="***AWS_ACCESS_KEY_ID***" | |
key_secret="***AWS_SECRET_ACCESS_KEY***" | |
path="your/path/$file" | |
bucket="your-bucket" | |
content_type="application/octet-stream" | |
date="$(LC_ALL=C date -u +"%a, %d %b %Y %X %z")" | |
md5="$(openssl md5 -binary < "$file" | base64)" |
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
s = "Tomás Augusto Müller" | |
# Hex Array | |
# | |
s.unpack('U' * s.length).collect { |x| x.to_s(16) } | |
# Hex String | |
# | |
s.unpack('U' * s.length).collect { |x| x.to_s(16) }.join |
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
function currentTimeMillis() { | |
list($usec, $sec) = explode(" ", microtime()); | |
return round(((float)$usec + (float)$sec) * 1000); | |
} |