This file contains hidden or 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
| ;; while working within a 'with-open' block care should be taken | |
| ;; about the procedure which return a lazy sequence. | |
| ;; block which might trigger a "Stream closed" error | |
| (with-open [s (-> (java.io.StringReader. "you may not get this string") | |
| java.io.BufferedReader.)] | |
| (read-line s)) | |
| ;; block which will surely return the line read |
This file contains hidden or 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
| # fastboot oem rebootRUU - takes the phone into RUU mode | |
| # fastboot flash zip <path-to-zip-file-from-RUU> [required twice, will be directed by fastboot itself] |
This file contains hidden or 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
| (let [string "this is a string"] | |
| (reduce (fn [h ch] | |
| (if (get h ch) | |
| (assoc h ch (inc (get h ch))) | |
| (assoc h ch 1))) | |
| {} | |
| string)) |
This file contains hidden or 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
| "this is a string".scan(/./).reduce(Hash.new(0)) { |hash, ch| hash[ch] += 1; hash } |
This file contains hidden or 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(hash, char): | |
| if hash.has_key(char): | |
| hash[char] = hash[char] + 1 | |
| else: | |
| hash[char] = 1 | |
| return hash | |
| reduce(frequency, list("string it is"), {}) |
This file contains hidden or 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
| for branch in $(git branch -r | grep -v master); do | |
| git checkout -tb $(echo $branch | cut -d'/' -f2) $branch; | |
| done |
This file contains hidden or 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
| startup_message off | |
| # Allow bold colors - necessary for some reason | |
| attrcolor b ".I" | |
| # Tell screen how to set colors. AB = background, AF=foreground | |
| termcapinfo xterm 'Co#256:AB=\E[48;5;%dm:AF=\E[38;5;%dm' | |
| # Enable 256 color term | |
| term xterm-256color |
This file contains hidden or 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
| $ time echo 'exit' | bash -li | |
| $ exit | |
| logout | |
| real 0m0.382s | |
| user 0m0.174s | |
| sys 0m0.163s |
This file contains hidden or 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
| $ time echo 'exit' | bash -li | |
| $ exit | |
| logout | |
| real 0m0.039s | |
| user 0m0.009s | |
| sys 0m0.020s |
This file contains hidden or 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 rvm() { | |
| unset -f "rvm"; | |
| local SCRIPT="$HOME/.rvm/scripts/rvm" | |
| [[ -s ${SCRIPT} ]] && source ${SCRIPT}; | |
| rvm "$@"; | |
| } |
OlderNewer