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
# luigi 1.x is renamed to luigi1 | |
from luigi1 import Task as Task1 | |
# luigi 2.x is imported as usual | |
from luigi import Task |
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
# compiled requirements.txt, or Pipfile.lock (aka "lock file") | |
certifi==2018.8.24 # via requests | |
chardet==3.0.4 # via requests | |
click==6.7 # via flask | |
flask==1.0.2 | |
idna==2.7 # via requests | |
itsdangerous==0.24 # via flask | |
jinja2==2.10 # via flask | |
markupsafe==1.0 # via jinja2 | |
requests==2.19.1 |
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
pub fn search_bouncy() -> i32 { | |
//! procedural implementation | |
let mut n = 100; | |
let mut hit = 0.0; | |
let mut total = 100.0; | |
while hit / total < 0.99 { | |
n = n + 1; | |
if is_bouncy(n) { | |
hit = hit + 1.0; | |
} |
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 | |
# Usage: ./resize.sh [container ID]+ | |
set -o errexit | |
set -o nounset | |
set -o pipefail | |
sudo apt-get -qqy install jq socat | |
while [[ -n ${1:-''} ]]; do |
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 | |
# 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 \ |
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 | |
# child.sh | |
# Prints all args. | |
while (( "$#" )); do | |
echo "arg: $1" | |
shift | |
done |
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
#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 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 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 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 |