Skip to content

Instantly share code, notes, and snippets.

Birch-san

View GitHub Profile
@Birch-san
Birch-san / pluck.js
Created May 6, 2019 — forked from kevincennis/pluck.js
Karplus-Strong with Web Audio API
View pluck.js
function Pluck( ctx ) {
this.sr = ctx.sampleRate;
this.pro = ctx.createScriptProcessor( 512, 0, 1 );
this.pro.connect( ctx.destination );
}
Pluck.prototype.play = function( freq ) {
var N = Math.round( this.sr / freq ),
impulse = this.sr / 1000,
y = new Float32Array( N ),
@Birch-san
Birch-san / pwnedpass.sh
Last active Apr 23, 2019
Detect whether any password in your KeePassXC database was exposed in a data breach (using Troy Hunt's Pwned Passwords API)
View pwnedpass.sh
#!/usr/bin/env bash
# Licensed by author Alex Birch under CC BY-SA 4.0
# https://creativecommons.org/licenses/by-sa/4.0/
# detects whether any of your passwords have been exposed in a data breach, by
# submitting (prefixes of hashes of) all your passwords to Troy Hunt's
# Pwned Passwords API.
# https://haveibeenpwned.com/Passwords
@Birch-san
Birch-san / hex_printf.cpp
Created Nov 20, 2018
Printing 64-bit unsigned integer as hexadecimal
View hex_printf.cpp
#include <stdio.h>
#include <inttypes.h>
int main(int argc, char** argv) {
uint64_t val = (1ULL<<29) -1ULL;
printf("0x%" PRIx64 "\n", val);
return 0;
}
@Birch-san
Birch-san / sshfs_mount.sh
Last active Oct 27, 2018
How to use OSXFUSE + SSHFS to mount/unmount a remote filesystem
View sshfs_mount.sh
#!/bin/sh
# mounts a host named 'mycoolhost' (as described in SSH config):
# ./sshfs_mount.sh
# unmount:
# ./sshfs_mount.sh 0
REMOTE_HOST='mycoolhost'
REMOTE_DIR='/home/mycooluser'
VOLNAME="$REMOTE_HOST"
@Birch-san
Birch-san / http-minimal.py
Created Oct 8, 2018
Just print sequence numbers of all TCP packets
View http-minimal.py
#!/usr/bin/python
# invoke with:
# sudo ./http-minimal.py -i docker0
from bcc import BPF
from sys import argv
import socket
import os
@Birch-san
Birch-san / http-parse-seq.py
Created Aug 12, 2018
BCC TCP packet sequence number logger
View http-parse-seq.py
#!/usr/bin/python
#
# Forked from https://github.com/iovisor/bcc/blob/master/examples/networking/http_filter/http-parse-complete.py
# I've removed almost all functionality. It now simply prints the sequence number of every packet submitted, and does not perform any cleanup.
# =====
#Bertrone Matteo - Polytechnic of Turin
#November 2015
#
#eBPF application that parses HTTP packets
#and extracts (and prints on screen) the URL contained in the GET/POST request.
@Birch-san
Birch-san / http-parse-bespoke.py
Last active Jul 19, 2018
Count HTTP bytes inbound, outbound, grouped by an aspect of URL in HTTP request URI
View http-parse-bespoke.py
#!/usr/bin/python
#
#Bertrone Matteo - Polytechnic of Turin
#November 2015
#
#Additions made by Alex Birch, July 2018
#to correlate HTTP reply back to HTTP request, and accumulate & print statistics
#
#eBPF application that parses HTTP packets
#and extracts (and prints on screen) the URL contained in the GET/POST request.
@Birch-san
Birch-san / make_portable.sh
Last active Mar 10, 2020
Make a macOS executable binary or .dylib portable
View make_portable.sh
#!/usr/bin/env bash
# Licensed by author Alex Birch under CC BY-SA 4.0
# https://creativecommons.org/licenses/by-sa/4.0/
# Example input:
# ./make_portable.sh mycoolbinary
# where mycoolbinary is a mach-o object file
# (for example an executable binary or a .dylib)
#
@Birch-san
Birch-san / update_ungoogled_chromium_extensions.sh
Created May 30, 2018 — forked from pjv/update_ungoogled_chromium_extensions.sh
get latest version of installed ungoogled chromium extensions
View update_ungoogled_chromium_extensions.sh
#!/usr/bin/env bash
# dependencies:
# https://www.npmjs.com/package/chrome-web-store-item-property-cli
# https://stedolan.github.io/jq/
# curl
# Ascertain directory in which script lives; compatible with all UNIX
# Thanks to kenorb
# http://stackoverflow.com/a/17744637/5257399
@Birch-san
Birch-san / gist:7f3c8d4fe5cf3feea704b170e8b16298
Created Apr 16, 2018
Blocked on mutex inside AudioObjectGetPropertyDataSize (CoreAudio.framework, AudioHardware.h)
View gist:7f3c8d4fe5cf3feea704b170e8b16298
__psynch_mutexwait 0x00007fff55a07d1e
_pthread_mutex_lock_wait 0x00007fff55b43bfe
_pthread_mutex_lock_slow 0x00007fff55b41551
HALB_Mutex::Lock() 0x00007fff2da9c91f
HALC_ProxyIOContext::GetPropertyDataSize(AudioObjectPropertyAddress const&, unsigned int, void const*, unsigned int&) const 0x00007fff2dab9fe1
HALC_ShellObject::GetPropertyDataSize(unsigned int, AudioObjectPropertyAddress const&, unsigned int, void const*, unsigned int&) const 0x00007fff2dacecc8
HAL_HardwarePlugIn_ObjectGetPropertyDataSize(AudioHardwarePlugInInterface**, unsigned int, AudioObjectPropertyAddress const*, unsigned int, void const*, unsigned int*) 0x00007fff2dace4bf
HALPlugIn::ObjectGetPropertyDataSize(HALObject const&, AudioObjectPropertyAddress const&, unsigned int, void const*) const 0x00007fff2dace22c
AudioObjectGetPropertyDataSize 0x00007fff2dac9fb1
get_num_outputs 0x000000011c065584
You can’t perform that action at this time.