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
# This gist is from | |
# https://reasoniamhere.com/2014/01/11/outrageously-useful-tips-to-master-your-z-shell/ | |
cd ${TMP:-/tmp} | |
# create the folder structure | |
mkdir -p zsh_demo/{data,calculations}/africa/{kenya,malawi}/ \ | |
zsh_demo/{data,calculations}/europe/{malta,poland}/ \ | |
zsh_demo/{data,calculations}/asia/{nepal,laos}/ |
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 zsh | |
hooks=(chpwd periodic precmd preexec zshaddhistory zshexit) | |
for hook in $hooks; do | |
# First eval the hook function, stored as string | |
eval "hook_func_str=$\"${hook}_functions\"" | |
# [expansion rule](http://zsh.sourceforge.net/Doc/Release/Expansion.html#Rules) | |
# [Parameter expansion flags](http://zsh.sourceforge.net/Doc/Release/Expansion.html#Parameter-Expansion-Flags) | |
eval "hookfunc=\"${hook_func_str}\"" |
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
# Example from traitlets documentation | |
from traitlets import Bool, HasTraits, Int, TraitError, observe, validate | |
class Parity(HasTraits): | |
value = Int() | |
parity = Int() | |
@validate("value") |
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 python | |
import pika, sys, os | |
def main(): | |
connection = pika.BlockingConnection(pika.ConnectionParameters(host='localhost')) | |
channel = connection.channel() | |
channel.queue_declare(queue='hello') | |
def callback(ch, method, properties, body): |
OlderNewer