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
| # http://stackoverflow.com/questions/15393441/obfuscated-c-code-contest-2006-please-explain-sykes2-c | |
| cd $(mktemp -d /tmp/clock.XXXX) | |
| cat > clock.c <<C | |
| main(_){_^448&&main(-~_);putchar(--_%64?32|-~7[__TIME__-_/8%8][">'txiZ^(~z?"-48]>>";;;====~$::199"[_*2&8|_/64]/(_&2?1:8)%8&1:10);} | |
| C | |
| gcc -o clock clock.c |
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
| package web | |
| import com.sun.net.httpserver._ | |
| import java.net.InetSocketAddress | |
| import java.net.Inet4Address | |
| case class Answer(code: Int, body: String) | |
| class MyServer(port: Int) { | |
| type Handler = String => Answer |
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
| require "active_support/time" | |
| # in 3 days | |
| Time.fluent("+3d") | |
| # Tomorrow at 10 am | |
| Time.fluent("+1d @10h") | |
| class Time | |
| def self.fluent(at) |
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
| class ThreadLocal | |
| def [](key) | |
| Thread.current[key] | |
| end | |
| def []=(key, value) | |
| Thread.current[key] = value | |
| end | |
| end |
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! PrettyJSON() | |
| silent %!python -mjson.tool | sed -e 's/\s*$//' | |
| endfunction | |
| command! Fjson call PrettyJSON() |
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
| " F9 key will trigger syntax validation | |
| autocmd FileType ruby map <F9> :w<CR>:!ruby -c %<CR> | |
| " Edition configuration (tabs=2spaces & autoindent) | |
| fun! SetupRuby() | |
| set shiftwidth=2 | |
| set softtabstop=2 | |
| set expandtab | |
| set autoindent | |
| endfun |
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! PrettyXML() | |
| silent %!xmllint --format --encode UTF-8 --recover - 2>/dev/null | |
| endfunction | |
| command! Fxml call PrettyXML() | |
| "-- format xml when trigger Ctrl-Shift-F (only if filetype=xml) | |
| autocmd FileType xml map <C-S-F> :Fxml<CR> |
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
| /usr/bin/printf %0.f%%\\n $(echo $(cat /proc/loadavg | cut -d" " -f1) / $(grep -c processor /proc/cpuinfo) "* 100" | bc -l) |
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
| #!/bin/bash | |
| # This can be used this way : git rm-others <rm-options> | |
| # It will remove files with the status "?" and preserve files ignored. | |
| # It won't remove empty directories unlike git clean -fdx | |
| # This file should be renamed to git-rm-others and appended to the PATH | |
| # The file is named git-rm-others.sh to enable gist syntax colorization | |
| RM_OPTIONS=$* |
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
| #!/bin/bash -e | |
| # NB: the file is named git-incr-build.sh to let Gist colorize, but you should name it git-incr-build | |
| # Put this script in your PATH and call it this way: | |
| # git incr-build clean install | |
| # Can be combined with git pull --rebase and git push to make an "fast & safe push" script | |
| function branchName { | |
| git rev-parse --symbolic-full-name --abbrev-ref $1 | |
| } |