Skip to content

Instantly share code, notes, and snippets.

@nom3ad
nom3ad / HowToOTG.md
Created December 2, 2016 19:45 — forked from gbaman/HowToOTG.md
Simple guide for setting up OTG modes on the Raspberry Pi Zero

Raspberry Pi Zero OTG Mode

Simple guide for setting up OTG modes on the Raspberry Pi Zero - By Andrew Mulholland (gbaman).

The Raspberry Pi Zero (and model A and A+) support USB On The Go, given the processor is connected directly to the USB port, unlike on the B, B+ or Pi 2 B, which goes via a USB hub.
Because of this, if setup to, the Pi can act as a USB slave instead, providing virtual serial (a terminal), virtual ethernet, virtual mass storage device (pendrive) or even other virtual devices like HID, MIDI, or act as a virtual webcam!
It is important to note that, although the model A and A+ can support being a USB slave, they are missing the ID pin (is tied to ground internally) so are unable to dynamically switch between USB master/slave mode. As such, they default to USB master mode. There is no easy way to change this right now.
It is also important to note, that a USB to UART serial adapter is not needed for any of these guides, as may be documented elsewhere across the int

@nom3ad
nom3ad / vbscript_wine.md
Created December 3, 2016 06:07 — forked from Ravenstine/vbscript_wine.md
Installing VBScript in Wine (Linux)

How to Run VBScripts in Wine

It's very easy but not straight-forward or documented anywhere.

First, install Wine 1.6.2. This version probably isn't required, but it's the version that currently ships with Debian Jessie and it works with VBScript.

Install Winetricks and use it to add the following libraries:

  • wsh57
import threading
def spawnthread(f):
def func(*args,**kwargs):
thr = threading.Thread(target=f, args=args, kwargs=kwargs)
thr.start()
return func
# --------------------------
import time
# taken from http://www.piware.de/2011/01/creating-an-https-server-in-python/
# generate server.xml with the following command:
# openssl req -new -x509 -keyout server.pem -out server.pem -days 365 -nodes
# run as follows:
# python simple-https-server.py
# then in your browser, visit:
# https://localhost:4443
import BaseHTTPServer, SimpleHTTPServer
import ssl
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.*;
import org.mortbay.jetty.Server;
import org.mortbay.jetty.servlet.ServletHolder;
public class jettyServletEmbedding {
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PushbackInputStream;
import java.util.zip.GZIPInputStream;
import javax.servlet.ServletException;
import javax.servlet.http.*;
import org.mortbay.jetty.Server;
import org.mortbay.jetty.servlet.ServletHolder;
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@nom3ad
nom3ad / udp_hole_punch_tester.py
Created February 6, 2017 08:24 — forked from somic/udp_hole_punch_tester.py
UDP Hole Punching test tool
#!/usr/bin/env python
#
# udp_hole_punch_tester.py - UDP Hole Punching test tool
#
# Usage: udp_hole_punch_tester.py remote_host remote_port
#
# Run this script simultaneously on 2 hosts to test if they can punch
# a UDP hole to each other.
#
# * remote_port should be identical on 2 hosts.
@nom3ad
nom3ad / git-http-proto.txt
Created February 27, 2017 13:44 — forked from schacon/git-http-proto.txt
Git HTTP transport protocol documentation
HTTP transfer protocols
=======================
Git supports two HTTP based transfer protocols. A "dumb" protocol
which requires only a standard HTTP server on the server end of the
connection, and a "smart" protocol which requires a Git aware CGI
(or server module). This document describes both protocols.
As a design feature smart clients can automatically upgrade "dumb"
protocol URLs to smart URLs. This permits all users to have the
@nom3ad
nom3ad / SimpleHTTPServerWithUpload.py
Created March 25, 2017 17:18 — forked from UniIsland/SimpleHTTPServerWithUpload.py
Simple Python Http Server with Upload
#!/usr/bin/env python
"""Simple HTTP Server With Upload.
This module builds on BaseHTTPServer by implementing the standard GET
and HEAD requests in a fairly straightforward manner.
"""