Skip to content

Instantly share code, notes, and snippets.

View neoshrew's full-sized avatar

Andy Gelnar neoshrew

  • MATCHESFASHION
  • London, UK
View GitHub Profile
import dateutil.parser, datetime, pytz
def printy(thing):
print repr(thing)
x = datetime.datetime.utcnow()
printy(x)
x = pytz.utc.localize(x)
printy(x)
x = x.isoformat()
$python3 test.py
a
A
À La Garçonne
b
B
$python2 test.py
a
A
À La Garçonne
@neoshrew
neoshrew / docker-ip.sh
Last active September 2, 2016 09:56
docker ip script with bash auto completion
#!/usr/bin/env bash
alias docker-ip="docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}'"
function _docker-ip() {
# No need to worry about spaces in this output, because
# docker only allows names in the form [a-zA-Z0-9][a-zA-Z0-9_.-]*
local pos_comps=$(docker ps --format "{{.ID}} {{.Names}}")
# $COMP_WORDS array with the current line
# $COMP_WORD the current word we're comping