Skip to content

Instantly share code, notes, and snippets.

View q2dg's full-sized avatar

Osqui LittleRiver q2dg

  • Barcelona (Spain)
View GitHub Profile
@allanlw
allanlw / http2.py
Last active December 30, 2023 22:08
Generate an HTTP2 Request for piping to netcat
#!/usr/bin/env python
from __future__ import print_function
import struct
HTTP2_HDR="PRI * HTTP/2.0\r\n\r\nSM\r\n\r\n"
# Does the thing for a frame
def frame(ty, flags, streamid, payload):
return struct.pack(">L", len(payload))[1:4] + struct.pack(">BBL", ty, flags, streamid) + payload
@gdamjan
gdamjan / README
Last active November 6, 2020 20:10
Customize ubuntu live image
# first, get the iso from http://releases.ubuntu.com/
# make working dir hierarchy in /tmp (you'll need enough ram for this)
sudo mkdir -p /tmp/custom/{_squash,_work,iso,newiso,newlive,project}
sudo mount -o loop ~/Downloads/ubuntu-18.10-desktop-amd64.iso /tmp/custom/iso
sudo mount -t squashfs /tmp/custom/iso/casper/filesystem.squashfs /tmp/custom/_squash
sudo mount -t overlay overlay -onoatime,lowerdir=/tmp/custom/_squash,upperdir=/tmp/custom/project,workdir=/tmp/custom/_work /tmp/custom/newlive
# customize the live fs with systemd-nspawn (a better chroot)
sudo systemd-nspawn --bind-ro=/run/systemd/resolve/resolv.conf:/etc/resolv.conf --setenv=RUNLEVEL=1 -D /tmp/custom/newlive
/* 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 http://www.arduino.cc/playground/Learning/ArduinoSleepCode
*
* 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