Skip to content

Instantly share code, notes, and snippets.

@guyzmo
guyzmo / serial_tcp_redirect.py
Created May 22, 2016 19:12
serial→tcp redirect with split on line endings
#!/usr/bin/env python
# based on tcp_serial_redirect.py from pyserial
# http://pyserial.sourceforge.net/
"""USAGE: serial_tcp_redirect.py [options]
Simple Serial to Network (TCP/IP) redirector.
This redirector waits for data from the serial port, then connects
to the remote host/port and relays data back and forth. If either
@guyzmo
guyzmo / random-fortune-1.txt
Created May 21, 2016 17:29
this is a test.
No one can guarantee the actions of another.
-- Spock, "Day of the Dove", stardate unknown
@guyzmo
guyzmo / random-fortune-1.txt
Created May 21, 2016 17:27
this is a test.
Your best consolation is the hope that the things you failed to get weren't
really worth having.
@guyzmo
guyzmo / random-fortune-1.txt
Created May 21, 2016 16:23
this is a test.
Your best consolation is the hope that the things you failed to get weren't
really worth having.
@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):
@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 / 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 / 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 / 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 / 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'