Skip to content

Instantly share code, notes, and snippets.

View msuntharesan's full-sized avatar
🏠
Working from home

Suntharesan Mohan msuntharesan

🏠
Working from home
View GitHub Profile
@msuntharesan
msuntharesan / aws_config.fish
Created July 22, 2021 11:30 — forked from davewongillies/aws_config.fish
Fish shell function to set your AWS credentials with MFA
function aws_config
if not fgrep -q "[$argv]" ~/.aws/credentials
echo "Please specify a valid profile."
else
set token_expired false
if test $AWS_SESSION_EXPIRY
set now (date +%s)
# WARNING: this date command only works with GNU date
@msuntharesan
msuntharesan / togeo.py
Created November 21, 2017 17:15 — forked from tmcw/togeo.py
geo-assign any arbitrary image to a geotiff usable in tilemill
import subprocess
import sys, re
MERC = '+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs'
infile = sys.argv[1]
info_output = subprocess.Popen(['gdalinfo', infile], stdout=subprocess.PIPE).communicate()[0]
size_is_re = re.compile('Size is (?P<width>\d+), (?P<height>\d+)')
size_is = filter(lambda x: x, map(lambda x: size_is_re.match(x), info_output.split('\n')))