Skip to content

Instantly share code, notes, and snippets.

import calendar
import datetime
def get_utc_timestamp():
return calendar.timegm(datetime.datetime.utcnow().utctimetuple())
@josephsu
josephsu / gist:4481205
Created January 8, 2013 04:39
decode Data URI to mime and data parts
import base64
def decodeDataUri(uristr):
comma = uristr.find(',')
urihead = uristr.find('data:')
if urihead is None or comma is None:
return None
headpart = uristr[urihead + 5:comma]
firstsep = headpart.find(';')
@josephsu
josephsu / gist:5127670
Created March 10, 2013 08:43
td-agent ( fluentd ) logrotate.d setting
/var/log/td-agent/td-agent.log {
size 200M
rotate 6
missingok
create 644 td-agent td-agent
compress
delaycompress
notifempty
sharedscripts
postrotate