Skip to content

Instantly share code, notes, and snippets.

@rossja
rossja / runpi.sh
Last active October 22, 2020 14:52
QEMU Raspberry Pi 2 Emulation on Mac OS X
#!/bin/bash
# tested on Max OS X 10.13.2 "High Sierra"
# install qemu using: `brew install qemu`
# get kernel from: https://github.com/dhruvvyas90/qemu-rpi-kernel/blob/master/kernel-qemu-4.4.34-jessie?raw=true
# get raspbian image from: http://downloads.raspberrypi.org/raspbian_latest
qemu-system-arm \
-kernel kernel-qemu-4.4.34-jessie \
-cpu arm1176 \
@samdroid-apps
samdroid-apps / btrfs-nixos-install.sh
Last active February 3, 2023 13:16 — forked from alcol80/btrfs-nixos-install.sh
nixos install (boot + btrfs)
mkfs.vfat -n BOOT /dev/sda1
mkfs.btrfs -L root /dev/sda2
mount -t btrfs /dev/sda2 /mnt/
btrfs subvolume create /mnt/nixos
umount /mnt/
mount -t btrfs -o subvol=nixos /dev/sda2 /mnt/
btrfs subvolume create /mnt/var
btrfs subvolume create /mnt/home
btrfs subvolume create /mnt/tmp
@tintinweb
tintinweb / scapy_tcp_handshake.py
Last active August 4, 2023 19:58
simple scapy tcp three-way handshake
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
# Author : tintinweb@oststrom.com <github.com/tintinweb>
'''
A simple TCP three-way handshake example
#> python scapy_tcp_handshake.py
DEBUG:__main__:init: ('oststrom.com', 80)
DEBUG:__main__:start
DEBUG:__main__:SND: SYN
@liuyangc3
liuyangc3 / find-futex-wait.sh
Last active October 8, 2019 12:19 — forked from amr/find-futex-wait.sh
Find processes executing futex with FUTEX_WAIT (helps find deadlock-ed processes)
#!/bin/bash
#
# Find all processes that are executing a futex(2) call with op=FUTEX_WAIT
# In some cases this can be helpful in finding deadlock-ed processes.
#
test ! $UID -eq 0 && echo -e "WARNING: Not running as root, only processes for this user are being scanned\n" >&2;
pids=$(ps -u $UID -opid --no-headers)
sub_pid=$(($$+1))
@LucienLee
LucienLee / joystick
Last active December 17, 2019 14:26
Sanwa joystick on Arduino example code
//A0 = green, A1 = yellow, A2 = orange, A3 = red
#define downPin 14
#define upPin 15
#define rightPin 16
#define leftPin 17
void setup() {
Serial.begin(9600);
@bvssvni
bvssvni / gist:9674632
Last active December 23, 2023 22:56
A Rust Chain Macro
//! Chain macro in Rust
//!
//! A typical usage is to avoid nested match expressions.
//!
//! Supports:
//! - Pattern matching
//! - Or expressions (A | B => ...)
//! - Guarded statements (x if <cond> => ...)
//! - Implicit else (requires all arms to return same type)
@dex4er
dex4er / eToken-9.sh
Last active October 31, 2023 15:05
eToken
# udev
wget https://gist.githubusercontent.com/dex4er/1354710/raw/0f9738c7439cdfb9e4446663d137f91ee153b4d8/etc_udev_rules.d_90-hid-eToken.rules
sudo cp etc_udev_rules.d_90-hid-eToken.rules /etc/udev/rules.d
sudo service udev reload
# required packages
sudo apt-get -yy install pcscd opensc
# legacy library
wget http://mirrors.kernel.org/ubuntu/pool/universe/h/hal/libhal1_0.5.14-8_amd64.deb
@amr
amr / find-futex-wait.sh
Created November 30, 2010 18:37
Find processes executing futex with FUTEX_WAIT (helps find deadlock-ed processes)
#!/bin/bash
#
# Find all processes that are executing a futex(2) call with op=FUTEX_WAIT
# In some cases this can be helpful in finding deadlock-ed processes.
#
test ! $UID -eq 0 && echo -e "WARNING: Not running as root, only processes for this user are being scanned\n" >&2;
pids=$(ps -u $UID -opid --no-headers)
for pid in $pids; do