Skip to content

Instantly share code, notes, and snippets.

@rcarmo
rcarmo / decorator.py
Created March 5, 2016 19:23 — forked from j0lvera/decorator.py
bottle.py basic auth examples
from bottle import route, run, auth_basic
from passlib.hash import sha256_crypt
def check_pass(username, password):
hashed = ''.join(redis.hmget(username, "password"))
return sha256_crypt.verify(password, hashed)
@route('/', method='GET')
@auth_basic(check_pass) # <-- decorator
def index():
/*
Example code to get a MCP3*08 running with an ESP8266
for DiY energy monitoring solutions
*/
#include <Arduino.h>
#include <ESP8266WiFi.h>
#include "MCP3208.h"
const char* ssid = "...";
const char* host = "...";
@rcarmo
rcarmo / gist:4255864f2755636b22cc29a8c2c9230b
Created August 9, 2016 13:59 — forked from tonymtz/gist:714e73ccb79e21c4fc9c
Uninstall XQuartz.app from OSX El Capitan
launchctl unload /Library/LaunchAgents/org.macosforge.xquartz.startx.plist
sudo launchctl unload /Library/LaunchDaemons/org.macosforge.xquartz.privileged_startx.plist
sudo rm -rf /opt/X11* /Library/Launch*/org.macosforge.xquartz.* /Applications/Utilities/XQuartz.app /etc/*paths.d/*XQuartz
sudo pkgutil --forget org.macosforge.xquartz.pkg
# Log out and log in
@rcarmo
rcarmo / gist:01ecea6a5e93e0de89d8d5d4c411638b
Created August 20, 2016 18:05 — forked from tofarley/gist:8285845
My Blender render farm ansible playbook.
---
- name: Create render slaves on Rackspace Cloud
hosts: renderslaves
user: root
connection: local
gather_facts: False
tasks:
- name: Provision a set of instances
local_action:
module: rax
@rcarmo
rcarmo / *bigcartel.slack.com*
Created October 20, 2016 19:06 — forked from alexparker/*bigcartel.slack.com*
UserScript for toggling slack sidebar
var sideBar = $('#col_channels_bg').is(':visible');
$(window).on('keypress', function(e) {
// uses cmd+b
if (e.metaKey && e.charCode == 98) {
var display = sideBar ? 'none' : 'initial';
var left = sideBar ? 0 : '';
$('#col_channels_bg, #col_channels').css('display', display);
$('#messages_container').css('margin-left', left);
$('#footer').css('left', left);
@rcarmo
rcarmo / aiohttp-server.py
Created February 25, 2017 22:04 — forked from gdamjan/aiohttp-server.py
Example: asyncio and aiohttp, handling longpoll, eventsource and websocket requests with a queue and background workers
from aiohttp import web
from threading import Thread
import asyncio
import time, uuid
loop = asyncio.get_event_loop()
def long_blocking_thing(sleep):
time.sleep(sleep)
return 42
@rcarmo
rcarmo / rPi3-ap-setup.sh
Last active September 25, 2017 14:10 — forked from Lewiscowles1986/rPi3-ap-setup.sh
Raspberry Pi 3 access-point-setup
#!/bin/bash
#
# Tweaked for Ubuntu
#
if [ "$EUID" -ne 0 ]
then echo "Must be root"
exit
fi
@rcarmo
rcarmo / pronto2broadlink.py
Last active April 12, 2018 02:10 — forked from appden/pronto2broadlink.py
Convert Pronto IR hex codes to LIRC pulses then Broadlink packets compatible with python-broadlink
@rcarmo
rcarmo / gist:cbd315bf4b058c23b65505d4c0a7c99c
Created April 20, 2019 15:59 — forked from nosuchuser/gist:21db3fdd9f4b80bf0910f8b8b6ea2f63
dnsmasq.conf configuration for vodafone IPTV
server=/.iptvpoc.alu/.discovery.iptv.microsoft.com/.iptv.vodafone.pt/.iptvdiscovery/.ims.vodafone.pt/192.168.1.1
@rcarmo
rcarmo / build_qemu_debian_image.sh
Created June 19, 2019 14:02 — forked from sigmaris/build_qemu_debian_image.sh
Automate the installation of Debian Buster on a x86_64 QEMU 4.0.0 VM hosted on macOS
#!/bin/bash -e
if [ "$(uname -s)" != "Darwin" ]
then
echo "This script is for building a Debian x86_64 image to use on MacOS"
exit 1
fi
TEMP="$(mktemp -d build.XXXXX)"
cp preseed.cfg $TEMP