Skip to content

Instantly share code, notes, and snippets.

View brennen's full-sized avatar

Brennen Bearnes brennen

View GitHub Profile
@brennen
brennen / checkmail.py
Last active June 15, 2017 16:23
checkmail.py
#!/usr/bin/env python
from imapclient import IMAPClient
import time
import RPi.GPIO as GPIO
DEBUG = True
HOSTNAME = 'imap.gmail.com'
@brennen
brennen / checkmail_simple.py
Created April 27, 2015 05:55
checkmail_simple.py
#!/usr/bin/env python
from imapclient import IMAPClient
import sys
import time
DEBUG = True
HOSTNAME = 'imap.gmail.com'
USERNAME = 'your username here'
pi@raspberrypi ~ $ cat switch.py
import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BCM)
GPIO.setup(23, GPIO.IN, pull_up_down=GPIO.PUD_UP)
while True:
input_state = GPIO.input(23)
brennen@exuberance 15:01:57 /home/brennen/code/adafruit-raspberrypi-linux (rpi-3.18.y-powerswitch) ★ git diff rpi-3.18.y.. drivers/power/rpi_power_switch.c
diff --git a/drivers/power/rpi_power_switch.c b/drivers/power/rpi_power_switch.c
index 049af00..baee336 100644
--- a/drivers/power/rpi_power_switch.c
+++ b/drivers/power/rpi_power_switch.c
@@ -24,9 +24,7 @@
#include <linux/workqueue.h>
-/* the BCM2709 redefines this for us right!
@brennen
brennen / mouselogger
Last active November 9, 2024 11:33
/etc/init.d/mouselogger
#! /bin/sh
### BEGIN INIT INFO
# Provides: mouselogger
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Adafruit-MouseLogger
# Description: Log mice.
### END INIT INFO
@brennen
brennen / errors.md
Last active September 3, 2015 23:59
hrmph.

ft6x06 error during compile:

CC [M]  drivers/input/touchscreen/ft6x06_ts.o
drivers/input/touchscreen/ft6x06_ts.c:472:2: error: unknown field 'suspend' specified in initializer
drivers/input/touchscreen/ft6x06_ts.c:472:2: warning: initialization from incompatible pointer type [enabled by default]
drivers/input/touchscreen/ft6x06_ts.c:472:2: warning: (near initialization for 'ft6x06_ts_driver.detect') [enabled by default]
drivers/input/touchscreen/ft6x06_ts.c:473:2: error: unknown field 'resume' specified in initializer
drivers/input/touchscreen/ft6x06_ts.c:473:2: warning: initialization from incompatible pointer type [enabled by default]
drivers/input/touchscreen/ft6x06_ts.c:473:2: warning: (near initialization for 'ft6x06_ts_driver.address_list') [enabled by default]
@brennen
brennen / BangOpen.vim
Created October 1, 2015 19:26 — forked from thcipriani/BangOpen.vim
Open the output of a command as a file in a new tab: i.e. :BangOpen which git-new-workdir
" BangOpen ------------------------------------------------------------ {{{
function! BangOpen(arg)
execute 'tabe ' . system(a:arg)
endfunction
command! -nargs=1 BangOpen :call BangOpen(<f-args>)
" }}}
@brennen
brennen / gist:5b797f6fbf29c4451b94
Created November 27, 2015 03:22
journalctl -e -u etcd2
Nov 27 01:21:43 coreos-2 systemd[1]: Started etcd2.
Nov 27 01:21:43 coreos-2 systemd[1]: Starting etcd2...
Nov 27 01:21:43 coreos-2 etcd2[883]: 2015/11/27 01:21:43 etcdmain: etcd Version: 2.1.2
Nov 27 01:21:43 coreos-2 etcd2[883]: 2015/11/27 01:21:43 etcdmain: Git SHA: ff8d1ec
Nov 27 01:21:43 coreos-2 etcd2[883]: 2015/11/27 01:21:43 etcdmain: Go Version: go1.4.2
Nov 27 01:21:43 coreos-2 etcd2[883]: 2015/11/27 01:21:43 etcdmain: Go OS/Arch: linux/amd64
Nov 27 01:21:43 coreos-2 etcd2[883]: 2015/11/27 01:21:43 etcdmain: setting maximum number of CPUs to 1, total number of available CPUs is 1
Nov 27 01:21:43 coreos-2 etcd2[883]: 2015/11/27 01:21:43 etcdmain: peerTLS: cert = /home/core/coreos.pem, key = /home/core/coreos-key.pem, ca = /home/core/ca.pem
Nov 27 01:21:43 coreos-2 etcd2[883]: 2015/11/27 01:21:43 etcdmain: listening for peers on https://10.132.206.153:2380
Nov 27 01:21:43 coreos-2 etcd2[883]: 2015/11/27 01:21:43 etcdmain: clientTLS: cert = /home/core/coreos.pem,
# This works when run from a shell:
#!/bin/sh
tmpfile=`mktemp /tmp/edit-clipboard.XXXXXX`
xclip -d localhost:1 -o > "$tmpfile"
"$EDITOR" "$tmpfile"
xclip -d localhost:1 -i "$tmpfile"
rm "$tmpfile"
# This doesn't work:
brennen@inertia 16:57:39 ~/code/wmf/releng/dev-images (master 0/0) ▣ make
docker-pkg --info -c dockerfiles/config.yaml build dockerfiles
Traceback (most recent call last):
File "/home/brennen/.local/lib/python3.5/site-packages/urllib3/contrib/pyopenssl.py", line 453, in wrap_socket
cnx.do_handshake()
File "/usr/lib/python3/dist-packages/OpenSSL/SSL.py", line 1426, in do_handshake
self._raise_ssl_error(self._ssl, result)
File "/usr/lib/python3/dist-packages/OpenSSL/SSL.py", line 1174, in _raise_ssl_error
_raise_current_error()
File "/usr/lib/python3/dist-packages/OpenSSL/_util.py", line 48, in exception_from_error_queue