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 node | |
const pgPromise = require("pg-promise"); | |
const Bluebird = require("bluebird"); | |
const QueryStream = require("pg-query-stream"); | |
const pgpInit = { promiseLib: Bluebird, capSQL: true }; | |
const pgp = pgPromise(pgpInit); | |
const db = pgp({ | |
host: process.env.POSTGRES_HOST, | |
port: Number.parseInt(process.env.POSTGRES_PORT || "5432"), |
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
#!/bin/bash | |
# rename files to lowercase | |
for F in `find -type f | grep -P '\/.*[A-Z]+.*$'`; do git mv $F ${F,,}; done; | |
# Search and replace: Use ack for Perl-style regexp pattern finding combined with sed for replacing | |
# Turn resource filenames mentions into lowercase | |
ack '(\w*[A-Z]+\w*\.(:?jpg|png|mp3|JPG|PNG|MP3))' src/ -o --noheading | \ | |
while IFS=":" read -r FILE LINE MATCH; do \ | |
sed -i "s/$MATCH/${MATCH,,}/" $FILE; |
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
import dateutil.parser | |
import pytz | |
input = '2013-10-13T00:59:45Z' # Zulu time = UTC | |
tz_syd = pytz.timezone('Australia/Sydney') | |
dt_utc = dateutil.parser.parse(intput) | |
dt_syd = dt_utc.astimezone(tz_syd) | |
print dt_syd.isoformat() # prints 2013-10-13T11:59:45+11:00 |