Skip to content

Instantly share code, notes, and snippets.

View gmorell's full-sized avatar
⛱️

Gabe gmorell

⛱️
View GitHub Profile
S (Consistently Good)
- Guru the Caterer
- Godavri
- Ritu Ki Rasoi
A (Good)
- Dosa And Curry
- Himalayan Kitchen
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
## Lights
import machine
import neopixel
np0 = neopixel.NeoPixel(machine.Pin(5), 200)
np1 = neopixel.NeoPixel(machine.Pin(19), 200)
for i in range(0,200):
np0[i] = (101,51, 0)
@gmorell
gmorell / container.yml
Created May 9, 2017 23:41
container variable expansion
version: "2"
settings:
# The deployment_output_path is mounted to the Conductor container, so
# that the `run` and `deployment` commands can write generated Ansible
# playbooks to it.
# deployment_output_path: ~/ansible-deployment
# The Conductor container does the heavy lifting, and provides a portable
# Python runtime for building your target containers. It should be derived
# from the same distribution as you're building your target containers with.
conductor_base: centos:7
from twisted.internet import reactor
from twisted.web.server import Site
from twisted.web.resource import Resource
import json, hmac
from hashlib import sha1
from blinker import signal
class WebhookServer(Resource):
import network
sta_if = network.WLAN(network.STA_IF)
ap_if = network.WLAN(network.AP_IF)
if not sta_if.isconnected():
sta_if.active(True)
sta_if.connect('YYY', '')
ap_if.active(False)
while not sta_if.isconnected():
pass
@gmorell
gmorell / secret-key-gen.py
Created March 15, 2016 04:15 — forked from ndarville/secret-key-gen.py
Generating a properly secure SECRET_KEY in Django
"""
Two things are wrong with Django's default `SECRET_KEY` system:
1. It is not random but pseudo-random
2. It saves and displays the SECRET_KEY in `settings.py`
This snippet
1. uses `SystemRandom()` instead to generate a random key
2. saves a local `secret.txt`
@gmorell
gmorell / rtorrent_xmlrpc.py
Created January 29, 2016 01:31 — forked from query/rtorrent_xmlrpc.py
Python module for interacting with rtorrent's XML-RPC interface directly over SCGI.
#!/usr/bin/python
# rtorrent_xmlrpc
# (c) 2011 Roger Que <alerante@bellsouth.net>
#
# Python module for interacting with rtorrent's XML-RPC interface
# directly over SCGI, instead of through an HTTP server intermediary.
# Inspired by Glenn Washburn's xmlrpc2scgi.py [1], but subclasses the
# built-in xmlrpclib classes so that it is compatible with features
# such as MultiCall objects.
@gmorell
gmorell / phone.py
Created November 10, 2015 18:43
:<
#!/usr/bin/env python
import os, sys
def get_state():
val = os.popen("adb shell dumpsys battery | grep level").read()
if val:
output = val.strip().rsplit("level: ")[1]
output = "%s%% \n" % output
else:
output = "Phone Disconnected \n"
@gmorell
gmorell / dict2xml.py
Last active August 29, 2015 14:14 — forked from reimund/dict2xml.py
"""
Simple xml serializer.
@author Reimund Trost 2013
Example:
mydict = {
'name': 'The Andersson\'s',
'size': 4,