Skip to content

Instantly share code, notes, and snippets.

View creiht's full-sized avatar

Chuck Thier creiht

  • H-E-B
  • San Antonio, TX
View GitHub Profile
@creiht
creiht / gist:10884668
Last active August 29, 2015 13:59
Get date and time from a swift transaction id (txid)
str(datetime.utcfromtimestamp(int(txid.split('-')[-1][:-4], 16)))

Keybase proof

I hereby claim:

  • I am creiht on github.
  • I am chuck (https://keybase.io/chuck) on keybase.
  • I have a public key whose fingerprint is BC9B FC42 F31E CA45 95AA EE67 9605 3A7F 25CB 7AE2

To claim this, I am signing this object:

@creiht
creiht / gist:7457109
Created November 13, 2013 21:53
Simple local cache implementation
import os
import sqlite3
import simplejson
import time
class LocalCache(object):
def __init__(self, path='/run/shm/cache.db'):
self.db = sqlite3.Connection(path)
{u'access_ip_v4': None,
u'access_ip_v6': None,
u'architecture': None,
u'auto_disk_config': False,
u'availability_zone': None,
u'cell_name': None,
u'cleaned': 0,
u'config_drive': u'',
u'created_at': u'2013-10-18T21:05:52.000000',
u'default_ephemeral_device': None,
@creiht
creiht / localcache.py
Created July 19, 2013 17:06
First stab at a sqlite based memcache api compatible localcache
import os
import sqlite3
import simplejson
import time
class LocalCache(object):
def __init__(self, path='/run/shm/cache.db'):
self.db = sqlite3.Connection(path)
@creiht
creiht / gist:4989660
Created February 19, 2013 20:32
Start for validating a swift proxy server config file
from paste.deploy import appconfig
from swift.proxy.server import Application
conf_file = '/etc/swift/proxy-server.conf'
conf = appconfig('config:%s' % conf_file, name='proxy-server')
proxy_app = Application(conf)
@creiht
creiht / gist:2976601
Created June 23, 2012 03:16
pep8 1.3.1 continuing line issues
# passes
foo = long_function_name(var_one, var_two,
var_three, var_four)
# passes
def long_function_name(
var_one, var_two,
var_three, var_four):
#####***********************************************######**
#...# ######## ###### #....# *
#...# #......# #### #....# ########### #....# *
#...# #......# #..# #....# #.........# #....# *
##### #......# #..# ###### #.........# #....# *
* #......# #..# ########### ###### *
##### #......# #..# *
#...# #### #......# #..# #####*
#...# #..# #......# #..# #...#*
#...# #..# #......# #### ############### #...#*
@creiht
creiht / gist:1925013
Created February 27, 2012 16:07
Rougelike map generation progress
******#######*******************######**********************
* #.....# ###### #....# ##############
* #.....# #....# #....# #............#
* #.....# #....# ###### #............#
* #.....# #....# #............#
* #.....# #....# ##############
*#### #.....# #....# *
*#..# #.....# #....# *
*#..# #.....# #....# ####### *
*#..# ####### #....# #.....# *
@creiht
creiht / gist:1823468
Created February 14, 2012 04:06
Hacking DictMixin to give me access to a list in 2 dimensions
"""
Map stuff
Legend::
'#' = wall
'.' = ground
'+' = door
' ' = nothing
"""