Skip to content

Instantly share code, notes, and snippets.


NicoHood NicoHood

View GitHub Profile
wesbarnett / backup
Created Apr 28, 2016
Incremental backup to external drive using snapper and btrfs send/receive
View backup
# James W. Barnett
# Takes snapshots of each snapper configuration. It then sends the snapshot to
# a location on an external drive. After the initial transfer, it does
# incremental snapshots on later calls. It's important not to delete the
# snapshot created on your system since that will be used to determine the
# difference for the next incremental snapshot.
# Can set the backup directory here, or in the snapper configuration file with
gbaman /
Last active May 12, 2022
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

View 0001-gcc.patch
--- gcc/lto-wrapper.c 2015-01-30 16:15:00.000000000 +0000
+++ gcc/lto-wrapper.c 2015-07-10 14:06:42.104411726 +0000
@@ -934,7 +934,7 @@
filename[p - argv[i]] = '\0';
file_offset = (off_t) loffset;
- fd = open (argv[i], O_RDONLY);
+ fd = open (argv[i], O_RDONLY|O_BINARY);
if (fd == -1)
pezz /
Last active Dec 17, 2020
Archlinux ARM encrypted root


Just some FYI, to get started:

  • I'm using a 16 GB Sandisk SD card.
  • I have a model B Pi, 512 MB RAM (not really relevant, thought I'd mention it).
  • Monitor and keyboard connected to the Pi itself, for now.
  • Network working, internet access.
View sleepdemoserial.c
/* Sleep Demo Serial
* -----------------
* Example code to demonstrate the sleep functions in a Arduino. Arduino will wake up
* when new data is received in the serial port USART
* Based on Sleep Demo Serial from
* Copyright (C) 2006 MacSimski 2006-12-30
* Copyright (C) 2007 D. Cuartielles 2007-07-08 - Mexico DF
* With modifications from Ruben Laguna 2008-10-15