To use watchman, run watchman file-to-watch sleep-time command-to-execute like so.
watchman test.txt 1 echo 'Tada!'
| #! /usr/bin/env node | |
| 'use strict'; | |
| const program = require('commander'); | |
| const fs = require('fs'); | |
| const { spawn } = require('child_process'); | |
| program | |
| .version('1.0.0') | |
| .option('-e, --environment <environment>', 'Environment to deploy to') | 
| function touchp() { | |
| mkdir -p "$(dirname "$1")/" && touch "$1" | |
| } | 
| import argparse | |
| import csv | |
| import sys | |
| parser = argparse.ArgumentParser(description='Replace values on a column level in CSV') | |
| parser.add_argument('--column', help='The column to replace in', required=True) | |
| parser.add_argument('--search', help='The value to search for', required=True) | |
| parser.add_argument('--replace', help='The value to replace it with', required=True) | 
| # Prints username@hostname working-directory> | |
| function prompt_party { | |
| PS1="\[\033[38;5;$(jot -r 1 1 256)m\]\u\[\033[00m\]" | |
| PS1="$PS1\[\033[38;5;$(jot -r 1 1 256)m\]@\[\033[00m\]" | |
| PS1="$PS1\[\033[38;5;$(jot -r 1 1 256)m\]\h\[\033[00m\] " | |
| PS1="$PS1\[\033[38;5;$(jot -r 1 1 256)m\]\w\[\033[00m\]> " | |
| } | |
| PROMPT_COMMAND=prompt_party | 
| captainsafia@eniac ~> ipython | |
| Python 2.7.12 (default, Jun 29 2016, 14:05:02) | |
| Type "copyright", "credits" or "license" for more information. | |
| IPython 4.2.0 -- An enhanced Interactive Python. | |
| ? -> Introduction and overview of IPython's features. | |
| %quickref -> Quick reference. | |
| help -> Python's own help system. | |
| object? -> Details about 'object', use 'object??' for extra details. | 
| In [1]: # What's the fastest way to convert a column of minutes to hours? | |
| In [2]: import pandas as pd | |
| In [3]: import numpy as np | |
| In [4]: minutes = pd.Series(np.random.randint(0, 1440, size=(20000))) | |
| In [5]: minutes.shape | |
| Out[5]: (20000,) | 
To use watchman, run watchman file-to-watch sleep-time command-to-execute like so.
watchman test.txt 1 echo 'Tada!'
| function zippy | |
| zip -r $argv[1].zip $argv[1] | |
| end | 
| function gh-pull | |
| git fetch $argv[1] pull/$argv[2]/head:pr-$argv[2] | |
| git checkout pr-$argv[2] | |
| end | 
| function cd { | |
| # Run the system CD command on the parameters that were passed in | |
| builtin cd "$@" | |
| # Check if the directory we are in now is a git directory | |
| if [ -d ".git" ]; then | |
| # If so, check to see that there are no uncommitted files | |
| if [ $(git status --porcelain 2>/dev/null| egrep "^(M| M)" | wc -l) ]; then | |
| # Rebase our current branch with upstream/master | |
| git fetch upstream && git rebase upstream/master | |
| fi |