Skip to content

Instantly share code, notes, and snippets.

@guyzmo
guyzmo / tornado_event_source_client.py
Created May 25, 2012 13:01
A Tornado-based library that enables Event Source support !
import sys
import argparse
import logging
log = logging.getLogger('eventsource.client')
from tornado.ioloop import IOLoop
from tornado.httpclient import AsyncHTTPClient, HTTPRequest
class Event(object):
def __init__(self):
@guyzmo
guyzmo / 0001-added-quotes-to-multiline-strings.patch
Created September 7, 2012 13:01
z.sh patch for multiline quotes
From 14916bac1a4bd4aa7382f84269852b626f09f98f Mon Sep 17 00:00:00 2001
From: Guyzmo <guyzmo....net>
Date: Fri, 7 Sep 2012 15:00:13 +0200
Subject: [PATCH] added quotes to multiline strings
---
z.sh | 70 ++++++++++++++++++++++++++++++++---------------------------------
1 files changed, 34 insertions(+), 36 deletions(-)
diff --git a/z.sh b/z.sh
@guyzmo
guyzmo / freevpn0.029__platform__io.patch
Created November 29, 2012 17:11
Patch for strnlen support in freevpn (for OSX 10.6)
diff --git a/platform/io.c b/platform/io.c
index 209666a..0a6c2cf 100644
--- a/platform/io.c
+++ b/platform/io.c
@@ -24,6 +24,16 @@
#if defined(__FreeBSD__)
#define IO_BSD
#elif defined(__APPLE__)
+size_t strnlen(const char *s, size_t maxlen)
+{
@guyzmo
guyzmo / strigi_osx10.6.8_homebrew.patch
Created December 16, 2012 15:46
Patch to be applied for homebrew's strigi.rb Formula.
diff --git a/libstreamanalyzer/include/strigi/analysisresult.h b/libstreamanalyzer/include/strigi/analysisresult.h
index 074fc43..0d7b37c 100644
--- a/libstreamanalyzer/include/strigi/analysisresult.h
+++ b/libstreamanalyzer/include/strigi/analysisresult.h
@@ -20,6 +20,8 @@
#ifndef STRIGI_ANALYSISRESULT_H
#define STRIGI_ANALYSISRESULT_H
+#include "/usr/include/time.h"
+
@guyzmo
guyzmo / stackoverflow_inbox.py
Created June 7, 2013 17:03
An enhanced implementation of authenticating to stackoverflow using python.
#!/usr/bin/env python
import sys
import urllib
import requests
from BeautifulSoup import BeautifulSoup
def get_google_auth_session(username, password):
session = requests.Session()
google_accounts_url = 'http://accounts.google.com'
@guyzmo
guyzmo / i2c_scanner.c
Created April 8, 2014 12:48
I2C scanner code for SL030
// by @guyzmo under WTFPL license
// http://i.got.nothing.to/hack/on/run-the-sl030-rfid-reader-on-linux/
#include <errno.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <linux/i2c-dev.h>
#include <sys/ioctl.h>
@guyzmo
guyzmo / pluzz.py
Last active August 29, 2015 14:01
Code to download movies from pluzz
"""\
Pluzz Downloader
Downloads a movie from the French Television VOD
Usage:
pluzz_downloader.py [<url>] [--gui] [-t <target>] [--avconv <avconv>]
Options:
-g --gui Launch graphical user interface
@guyzmo
guyzmo / simple-example-login-principals.py
Last active February 2, 2021 15:32
Simple example of Flask/Presst with Login and Principals (not working!)
#!/usr/bin/env python
from base64 import b64decode
from flask import Flask, current_app
from flask_sqlalchemy import SQLAlchemy
from flask_presst import PresstApi, ModelResource
from flask_presst.principal import PrincipalResource
from flask.ext.principal import UserNeed, RoleNeed
@guyzmo
guyzmo / mplabx.rb
Created February 6, 2015 17:00
cask formula for mplabx
cask :v1 => 'mplabx' do
version '2.30'
sha256 '551788c3f428590da3ee405ad3e6756a57ecb1c3dd4effe76fafebc10c4e1892'
depends => :java16
url 'http://www.microchip.com/mplabx-ide-osx-installer'
name 'Microchip MPLabX'
homepage 'http://www.microchip.com/pagehandler/en-us/family/mplabx/home.html'
license :commercial
@guyzmo
guyzmo / unicode_combined.py
Last active December 26, 2015 18:52
unicode combined class for better character counting and indexing
#!/usr/bin/env python3
import unicodedata
test_strings = [
"בְּרֵאשִׁית, בָּרָא אֱלֹהִים, אֵת הַשָּׁמַיִם, וְאֵת הָאָרֶץ",
"bête",
]
class unicomb(str):