Skip to content

Instantly share code, notes, and snippets.

View gist:9929911
import logging
import traceback
LOGGLY_URL = "{{ LOGGLY_ID }}/tag/{{ TAG }}/"
class LogglyHandler(logging.Handler):
def emit(self, record):
trace = None
exc = record.__dict__['exc_info']
View gist:6a8ef81823490f0adbdf
eCos - hal_diag_init
Init device '/dev/BrcmTelnetIoDriver'
Init device '/dev/ttydiag'
Init tty channel: 8130a258
Init device '/dev/tty0'
Init tty channel: 8130a278
Init device '/dev/haldiag'
HAL/diag SERIAL init
Init device '/dev/ser0'
BCM 33XX SERIAL init - dev: 0.2
View gist:41b8e78627de45803fc1
import json
import logging
from pyramid.response import Response
from pyramid.view import view_config, view_defaults
from sqlalchemy.sql.expression import and_, or_, not_
from sqlalchemy.orm.exc import NoResultFound
from .models import (
View gist:41ab4d44d5279755fcb2
mod.directive('mjGridArticle', ['$state', '$location', '$timeout', function($state, $location, $timeout) {
return {
restrict: 'EA',
priority: 0,
scope: false,
link: function (scope, element, attrs) {
var render = function() {
var toRender = {scope:scope, state: $state, location: $location, attrs: attrs };
React.renderComponent(window.GridArticle( {scope:scope, state: $state, location: $location, attrs: attrs }), element[0]);
nl5887 / W25Q256.patch
Created Aug 28, 2014
Flashrom support for Winbond W25Q256 (0x4019)
View W25Q256.patch
Index: flashchips.c
--- flashchips.c (revision 1846)
+++ flashchips.c (working copy)
@@ -13137,7 +13137,40 @@
.read = spi_chip_read,
.voltage = {2700, 3600},
+ {
+ .vendor = "Winbond",
nl5887 / gist:9670b9af6ba5eef7839f
Created Aug 29, 2014
LZMA add uncompressed size
View gist:9670b9af6ba5eef7839f
import mmap
import sys
with open(sys.argv[1], "r+b") as f:
# memory-map the file, size 0 means whole file
mm = mmap.mmap(f.fileno(), 0)
offset = int(sys.argv[2])
f2 = sys.stdout
nl5887 / gist:f654d670e1c28b809740
Last active Aug 29, 2015
Function to validate Pyramid authentication tickets (auth_tkt cookie)
View gist:f654d670e1c28b809740
import (
func authorize(r *http.Request) (userid string, err error) {
View gist:6ec23da93b3414709a27
### Keybase proof
I hereby claim:
* I am nl5887 on github.
* I am remcov ( on keybase.
* I have a public key whose fingerprint is 655E FFD1 D47E 0C42 D866 FB0C FED8 ECD4 B967 EC86
To claim this, I am signing this object:
nl5887 /
Created Oct 26, 2014
Shows metadata about the current cloud instance. For use in logon scripts or prompts.
instanceid=`curl -s`
amiid=`curl -s`
hostname=`curl -s`
instancetype=`curl -s`
kernelid=`curl -s`
securitygroups=`curl -s`