Skip to content

Instantly share code, notes, and snippets.

View bencord0's full-sized avatar

Ben Cordero bencord0

View GitHub Profile
@gbaman
gbaman / HowToOTG.md
Last active May 2, 2024 01:27
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

@jpetazzo
jpetazzo / README.md
Created January 9, 2015 17:06
Mouses Are Overrated!

Mouses Are Overrated

This script allows you to enable/disable your pointers on a Linux machine.

Usage:

mao.sh on   # enters "mouseless" mode
mao.sh off  # returns to "I can has clicks" mode

Note: if you just want to disable built-in pointers (to keep a mouse on the side

@awidegreen
awidegreen / promiscuous@.service
Created July 16, 2013 13:21
systemd service for promiscuous mode. On archlinux, store it under /etc/systemd/system/promiscuous@.service enable it with: systemctl enable promiscuous@enp1s0.service Difference between file from archwiki: add "After" and changed path from "/usr/sbin/ip" to "/usr/bin/ip" since every executable is now located there
[Unit]
Description=Set %i interface in promiscuous mode
After=network.target
[Service]
Type=oneshot
ExecStart=/usr/bin/ip link set dev %i promisc on
RemainAfterExit=yes
[Install]
package systemd
import (
"os"
"strconv"
"syscall"
)
const (
listenFdsStart = 3