Skip to content

Instantly share code, notes, and snippets.

Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@tam203
tam203 / offsetmap-part.py
Created February 28, 2019 11:15
__getitem__ from offsetmap.py for Medium article https://medium.com/p/a394fa48b671/
def __getitem__(self, path):
origpath = path
if '/' in path:
prefix, item = path.rsplit('/',1)
else:
prefix = ''
item = path
if self._chunk_re.match(item):
offset = self._get_offset(prefix)
@tam203
tam203 / offsetmap.py
Created February 28, 2019 11:02
offsetmap.py full - for Medium article https://medium.com/p/a394fa48b671
import s3fs
import re
import json
class OffSetS3Map(s3fs.S3Map):
def __init__(self, *args, temp_chunk_path=None, **kwargs):
self.temp_chunk_path = temp_chunk_path
self._offsets = {}
s3fs.S3Map.__init__(self, *args, **kwargs)
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@tam203
tam203 / version1
Created September 22, 2013 09:57
WOW LEDS
import urllib
import time
import RPi.GPIO as GPIO
GPIO.cleanup()
GPIO.setmode(GPIO.BCM)
GPIO.setup(7,GPIO.OUT)
pinNumbers = [4,17,22,23,24]
for i in pinNumbers:
GPIO.setup(i,GPIO.OUT)