These are some simple bash functions and scripts for making CSV/TSV files prettier on the command line
see http://stefaanlippens.net/pretty-csv.html for more information.
| sankeyDraw( | |
| { | |
| 'nodes': [ | |
| {name: "a"}, | |
| {name: "b"}, | |
| {name: "c"}, | |
| {name: "d"}, | |
| {name: "e"}, | |
| {name: "f"}, | |
| {name: "g"}, | 
| """ | |
| Snippet to list Python installation/packaging related version information. | |
| Execute it with the Python executable you want to inspect. | |
| Usage example with curl/wget tricks straight from this github gist | |
| (optionally replace `python` at the end with the desired alternative): | |
| curl -s https://gist.githubusercontent.com/soxofaan/cc4986cc507cb10f962d/raw/python-version-dump.py | python | 
| def _reconnect_ssh_agent_socket(args, stdin=None): | |
| import re | |
| print("Updating ssh-agent socket environment. Current value: $SSH_AUTH_SOCK = %s" % $SSH_AUTH_SOCK) | |
| # Use find to list candidate paths with timestamp (as float). | |
| raw = $(find /tmp/ssh-* -user @$(whoami) -name 'agent*' -printf '%T@:%p;') | |
| candidates = [(float(m.group(1)), m.group(2)) for m in re.finditer('([0-9.]*):(.*?);', raw)] | |
| # Take latest. | |
| $SSH_AUTH_SOCK = max(candidates)[1] | 
These are some simple bash functions and scripts for making CSV/TSV files prettier on the command line
see http://stefaanlippens.net/pretty-csv.html for more information.
| #!/bin/bash | |
| # Script to fix the SSH agent environment variable after reconnecting to a running screen session. | |
| # Usage: *source* this script (don't just execute). | |
| # For example, if you store it at ~/screen-ssh-agent-fix.sh, create this alias to have it available easily: | |
| # alias screenfix='source ~/screen-ssh-agent-fix.sh' | |
| echo "Updating ssh-agent socket environment.." | |
| echo "Current value: $SSH_AUTH_SOCK" | |
| export SSH_AUTH_SOCK=$(find /tmp/ssh-* -user `whoami` -name agent\* -printf '%T@ %p\n' 2>/dev/null | sort -k 1nr | sed 's/^[^ ]* //' | head -n 1) | 
| license: mit | |
| border: no | 
| import math | |
| def zequals(x): | |
| """ | |
| "Zequals" ruthless rounding: just keep one leading digit. | |
| examples: | |
| 123 -> 100 | |
| 4567 -> 5000 | |
| -0.0345 -> -0.03 | 
| license: mit | |
| height: 800 | |
| border: no |