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
public class Main { | |
// which method does it invoke? | |
public static void main(String[] args) { | |
Object o = "this is a string"; | |
asLong(o); | |
} | |
public static void asLong(String s) { | |
System.out.println("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
#!/usr/bin/env ruby | |
# Our test cases will always use the same dictionary file (with SHA1 | |
# 6b898d7c48630be05b72b3ae07c5be6617f90d8e). Running `test/harness` | |
# will automatically download this dictionary for you if you don't | |
# have it already. | |
path = ARGV.length > 0 ? ARGV[0] : '/usr/share/dict/words' | |
entries = File.read(path).split("\n") |
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 | |
exec java \ | |
-server \ | |
-Djava.awt.headless=true \ | |
-Xms256M \ | |
-XX:CompileThreshold=1400 \ | |
-Xloggc:./memory.log -verbose:gc -XX:+PrintGCDetails \ | |
-cp out \ | |
jim.SpellCheck \ | |
$@ |
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
# objects with at least one widget and at least one user | |
$ cat part-r-00000 | jq 'select((.widgets | length) > 0 and (.users | length) > 0)' |
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
import logging | |
def do_work(): | |
logging.debug("x") | |
if __name__ == '__main__': | |
# Register STDOUT as a log handler. | |
# There are other ways to register handlers, but this is the simplest way. | |
# See https://docs.python.org/2/library/logging.html#logging.basicConfig |
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/env bash | |
# Usage: | |
# Without trace, just run `./do-stuff.sh` | |
# With trace, use `BASH_XTRACEFD=3 ./do-stuff 3> trace.txt` | |
# Requires bash 4.+ | |
set -o pipefail | |
set -o nounset | |
set -o errexit | |
if [[ ${BASH_XTRACEFD:+x} ]]; then |
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 x(): | |
# using a function as a convenient global object | |
print 'hello!' | |
x.favorite_band = 'Maroon 5' | |
def went_to_music_festival(s): | |
print 'favorite band was ' + x.favorite_band |
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
#compdef vault | |
# See https://vaultproject.io/ | |
# Drop this file in ~/.oh-my-zsh/completions/_vault | |
subcommands=$(vault --help 2|& grep -E '^\s{4}' | awk '{printf $1; $1=""; print "\\:\x27"$0"\x27"}') | |
_arguments "1:subcommand:((${subcommands}))" | |
_message 'vault [-version] [-help] <command> [args]' |
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 | |
# child.sh | |
# Prints all args. | |
while (( "$#" )); do | |
echo "arg: $1" | |
shift | |
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
#!/bin/bash | |
# cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr --build . | |
# make | |
# make install DESTDIR=~/tmpinstalldir | |
fpm -f \ | |
-s dir \ | |
-t deb \ | |
-n libgit2 \ | |
-v 0.23.4ppa1 \ | |
-C ~/tmpinstalldir \ |