Skip to content

Instantly share code, notes, and snippets.

View tomasmuller's full-sized avatar
🎻

Tomás Augusto Müller tomasmuller

🎻
View GitHub Profile
@tomasmuller
tomasmuller / brave_chap10_exercise_2.clj
Created November 16, 2016 11:25
Brave and True - Chapter 10 (metaphysics) - Exercise 2
(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))))))
#!/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)"
@tomasmuller
tomasmuller / str_to_hex.rb
Created February 6, 2012 11:30
Ruby String to Hexadecimal
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
function currentTimeMillis() {
list($usec, $sec) = explode(" ", microtime());
return round(((float)$usec + (float)$sec) * 1000);
}