Skip to content

Instantly share code, notes, and snippets.

Ezequiel Muns ezk84

  • Berlin, Germany
View GitHub Profile
@ezk84
ezk84 / useful-bash-snippets.sh
Created Dec 20, 2017
List of useful bash snippets for common dev tasks.
View useful-bash-snippets.sh
#!/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;
@ezk84
ezk84 / changetz.py
Created Nov 12, 2013
Changing timezones in python
View changetz.py
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
You can’t perform that action at this time.