(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
#!/bin/bash | |
# | |
# DESCRIPTION: | |
# | |
# Set the bash prompt according to: | |
# * the active virtualenv | |
# * the branch/status of the current git repository | |
# * the return value of the previous command | |
# * the fact you just came from Windows and are used to having newlines in | |
# your prompts. |
This playbook has been removed as it is now very outdated. |
#include "Python.h" // should be before any standard headers | |
#include <errno.h> | |
#include <pthread.h> | |
static void* | |
non_python_thread(void *python_callback) { | |
//XXX without PyEval_InitThreads() it produces: | |
// Fatal Python error: PyEval_SaveThread: NULL tstate | |
//XXX with PyEval_InitThreads() it deadlocks!! | |
//XXX without PyGILState_*() (with/without PyEval_InitThreads()) it produces: |
#!/bin/sh | |
TABLE_SCHEMA=$1 | |
TABLE_NAME=$2 | |
mytime=`date '+%y%m%d%H%M'` | |
hostname=`hostname | tr 'A-Z' 'a-z'` | |
file_prefix="trimax$TABLE_NAME$mytime$TABLE_SCHEMA" | |
bucket_name=$file_prefix | |
splitat="4000000000" | |
bulkfiles=200 |
import cProfile | |
def profile_this(fn): | |
def profiled_fn(*args, **kwargs): | |
# name for profile dump | |
fpath = fn.__name__ + '.profile' | |
prof = cProfile.Profile() | |
ret = prof.runcall(fn, *args, **kwargs) | |
prof.dump_stats(fpath) |
# prompt examples: | |
# [3 jobs master virtualenv] ~/code/myproject/foo | |
# [1 job my-branch virtualenv] ~/code/bar/ | |
# [virtualenv] ~/code/ | |
# ~ | |
# Very, very fast, only requiring a couple of fork()s (and no forking at all to determine the current git branch) | |
if [[ "$USER" == "root" ]] | |
then | |
export PS1="\e[1;31m\]\u \[\e[1;33m\]\w\[\e[0m\] "; |
--- | |
# This has been tested with ansible 1.3 with these commands: | |
# ansible-playbook -i hosts ansible_conditionals_examples.yaml --extra-vars="hosts=myhosts isFirstRun=false" | |
# ansible-playbook -i hosts ansible_conditionals_examples.yaml --extra-vars="hosts=myhosts isFirstRun=true" | |
# ansible-playbook -i hosts ansible_conditionals_examples.yaml --extra-vars="hosts=myhosts" | |
# NB: The type of the variable is crucial! | |
- name: Ansible Conditionals Examples | |
hosts: $hosts | |
vars_files: |
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
Notes on installing multiple versions Java on Mac OSX using Homebrew and Jenv.
Homebrew is a superb tool for Mac for managing the installation of software. It's core command is brew
and it calls packages of software formula. If you are intrigued then you can check out the list of Formula in the brew Github repository.
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"