Skip to content

Instantly share code, notes, and snippets.

@jasonrm
jasonrm / md12xx-ses.patch
Last active May 12, 2021
Force Dell MD1200 / MD1220 enclosures as SES-enabled, e.g. /sys/class/enclosure/
View md12xx-ses.patch
From f9e8eaf3226009531b769635a6114f87da08291b Mon Sep 17 00:00:00 2001
From: "Jason R. McNeil" <jason@mcneil.dev>
Date: Wed, 12 May 2021 01:16:35 -0700
Subject: [PATCH] drivers/scsi/ses: Dell MD12XX enclosures support SES, despite
EncServ=0 as claimed by the device
---
drivers/scsi/ses.c | 26 +++++++++++++++++++++++---
1 file changed, 23 insertions(+), 3 deletions(-)
View archlinux-reverse-proxy.nginx
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
@jasonrm
jasonrm / flip.php
Created Sep 8, 2019
Filp a random bit in a string with PHP
View flip.php
<?php
function flip_random_bit(string $str)
{
$charIndex = random_int(0, strlen($str) - 1);
$bitIndex = random_int(0, 8);
$str[$charIndex] = chr(ord($str[$charIndex]) ^ 1 << $bitIndex);
return $str;
}
@jasonrm
jasonrm / default.nix
Last active Aug 18, 2019
shell.nix for running jupyter lab
View default.nix
{
pkgs ? import <nixpkgs> { },
}:
with pkgs;
python3.buildEnv.override {
ignoreCollisions = true;
extraLibs = with python3Packages; [
pip
ipykernel
jupyterlab
@jasonrm
jasonrm / grub.conf
Last active Jul 30, 2019
MacPro 1,1 boot 64-bit kernel from 32-bit UEFI
View grub.conf
set default=0
set timeout=1
# insmod efi_uga
insmod all_video
insmod font
if loadfont ${prefix}/unicode.pf2
then
insmod gfxterm
@jasonrm
jasonrm / common.liquidsoap
Last active Jul 9, 2019
For use with trunk-recorder & liquidsoap
View common.liquidsoap
set("tag.encodings",["UTF-8","ISO-8859-1"])
# Configure Logging
set("log.file",false)
set("log.level",3)
set("log.stdout",true)
set("log.syslog",false)
set("log.syslog.facility","DAEMON")
set("log.syslog.program","liquidsoap-#{STREAMID}")
@jasonrm
jasonrm / gist:b409008ea69dc6b0f121161b87978333
Created Jan 25, 2019
Edgerouter traffic-control advanced-queue
View gist:b409008ea69dc6b0f121161b87978333
set traffic-control advanced-queue queue-type hfq HFQ_UP_LAN host-identifier sip
set traffic-control advanced-queue queue-type hfq HFQ_UP_LAN max-rate 3mbit
set traffic-control advanced-queue queue-type hfq HFQ_UP_LAN subnet 10.76.32.0/24
set traffic-control advanced-queue queue-type hfq HFQ_UP_WIFI host-identifier sip
set traffic-control advanced-queue queue-type hfq HFQ_UP_WIFI max-rate 3mbit
set traffic-control advanced-queue queue-type hfq HFQ_UP_WIFI subnet 10.76.33.0/24
set traffic-control advanced-queue queue-type hfq HFQ_DOWN_LAN host-identifier dip
set traffic-control advanced-queue queue-type hfq HFQ_DOWN_LAN max-rate 3mbit
set traffic-control advanced-queue queue-type hfq HFQ_DOWN_LAN subnet 10.76.32.0/24
View decade_frames.py
import random
from time import sleep
import bizhawk.emu as emu
import bizhawk.gui as gui
from System.Drawing import Pen, Color
pen = Pen(Color.FromArgb(255, 255, 0, 0))
def update():
@jasonrm
jasonrm / pmtud.py
Last active Dec 11, 2018
Listen for "unreachable - need to frag" ICMP packets, update local route, and re-broadcast to all interfaces
View pmtud.py
#!/usr/bin/python2
# Based on: https://tools.ietf.org/html/rfc7690#section-3.2
# More info: https://blog.cloudflare.com/path-mtu-discovery-in-practice/
# Also: https://github.com/cloudflare/pmtud
# Dependencies: python2, netifaces, scapy
from scapy.all import Ether, ICMP, IP, IPerror, TCPerror, sendp, sniff, conf
from subprocess import call
@jasonrm
jasonrm / loop1p10.superblock
Created Jul 3, 2018
2010 BWM 328i CIC Hard Drive
View loop1p10.superblock
Disk /dev/loop1: 74.5 GiB, 80026361856 bytes, 156301488 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x6ad4b821
Device Boot Start End Sectors Size Id Type
/dev/loop1p1 63 156296384 156296322 74.5G 5 Extended
/dev/loop1p5 126 117451214 117451089 56G 4d QNX4.x