Skip to content

Instantly share code, notes, and snippets.

@Sirfrummel
Sirfrummel / slack.py
Created July 12, 2017 03:44 — forked from shauns/slack.py
Deleting and listing slack files, sorting by size
from slacker import Slacker
import itertools
slack = Slacker('<API TOKEN>')
pages = slack.files.list(page=1).body['paging']['pages']
all_the_files = list(itertools.chain(*[slack.files.list(page=i).body['files'] for i in range(1,pages + 1)]))
biggest_first = sorted(all_the_files, key=lambda f: f['size'], reverse=True)
@Sirfrummel
Sirfrummel / Statistics.js
Last active January 9, 2020 23:43
Loading Segment.io analytics.js open source version async
// Create a dummy analytics object until real loaded
window.analytics || (window.analytics = []);
window.analytics.methods = ['identify', 'track', 'trackLink', 'trackForm', 'trackClick', 'trackSubmit', 'page', 'pageview', 'ab', 'alias', 'ready', 'group', 'on', 'once', 'off'];
window.analytics.factory = function(method) {
return function() {
var args = Array.prototype.slice.call(arguments);
args.unshift(method);
window.analytics.push(args);
return window.analytics;
};
import time
import RPi.GPIO as io
io.setmode(io.BCM)
door_pin = 12
light_pin = 16
printed = 0
loop = 1
io.setup(door_pin, io.IN, pull_up_down=io.PUD_UP) # activate input with PullUp