Skip to content

Instantly share code, notes, and snippets.

View Riebart's full-sized avatar

Mike Riebart

View GitHub Profile
@Riebart
Riebart / encoding_options.json
Last active September 27, 2023 21:44
Generate a matrix of ffmpeg commands from a set of inputs.
{
"hevc_nvenc": {
"preset": [
"p7"
],
"tune": [
"hq"
],
"rc:v": [
"vbr"
@Riebart
Riebart / track_stuff.sh
Last active September 19, 2023 15:50
Some basic network monitoring scripts
#!/bin/bash
# Perform some basic DNS, TCP, TLS, and ICMP testing targeting a remote endpoint or two,
# to spot transient issues you'd normally miss in 5-minute aggregate date
#
# DNS-TCP pings are emitted as a CSV to stdout, floodping is emitted to stderr
# Example of how to run it and capture both outputs.
# NOTE: In the stderr redirect target shell, the stdout gets captured by the stdout subshell,
# so we need to foce that to stderr.
@Riebart
Riebart / README.md
Last active September 18, 2023 16:24
Proxy a Yubikey or smart card through from Windows to WSL2 with just socat.

HowTo Use

Windows

  • Install gnupg for Windows from gnupg.org (NOT GP4Win, the regular one).
  • Plug in your Yubikey, and run gpg --card-status, and make sure it emits some useful output about the card.

WSL1

We need WSL1 to act as the network proxy between the Windows TCP litening assuan socket, which is only on localhost, and a tcp socket listening on a host port that we can access from WSL2.

@Riebart
Riebart / test_ask.cpp
Created September 4, 2022 16:46
A simple test of ASK between two threads using a volatile incrementing global between them
#include <stdio.h>
#include <thread>
#include <random>
#include <stdint.h>
#include <utime.h>
#include <unistd.h>
#include <atomic>
float READ_NOISE_RATIO = 0.0;
int32_t swap_write_count = 0;
@Riebart
Riebart / contentdump.py
Created November 2, 2021 13:40
Brief mitmdump module for dumping content of responses to a file, and keeping track of what files are which URIs in a map JSON.
"""
Mitmdump extension script that can be used to dump content to disk in a way that can be processed after the fact by arbitrary tools.
"""
import time
import uuid
import json
import os.path
from mitmproxy import http
@Riebart
Riebart / ffmpeg_multitrack_audio.sh
Created October 19, 2021 17:41
ffmpeg Record multichannel audio from multiple sources to a single file
#!/bin/bash
# get device names from: ffmpeg -list_devices true -f dshow -i dummy
ffmpeg \
-f dshow -ac 1 -i audio="Audio Input Device A" \
-f dshow -ac 1 -i audio="Audio Input Device B" \
-ac 2 -filter_complex "[0:a][1:a]amerge[outA]" -map "[outA]:a" multitrack_out.wav
@Riebart
Riebart / test_ciphers.sh
Created October 2, 2021 00:42
Remote SSL Cipher Test
#!/usr/bin/env bash
# OpenSSL requires the port number.
SERVER=$1
DELAY=1
ciphers=$(openssl ciphers 'ALL:eNULL' | sed -e 's/:/ /g')
echo Obtaining cipher list from $(openssl version).
for cipher in ${ciphers[@]}
@Riebart
Riebart / gs_pdf_squash.sh
Created June 7, 2021 20:48
Squashing a PDF with ghostscript
#!/bin/bash
ghostscript -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/printer -dNOPAUSE -dQUIET -dBATCH -sOutputFile=output.pdf PDFsam_merge.pdf
#
# These variables are device properties. For people who are very
# curious about this, you can download the Windows Driver Kit headers and
# look for pciprop.h. All of these are contained in that file.
#
$devpkey_PciDevice_DeviceType = "{3AB22E31-8264-4b4e-9AF5-A8D2D8E33E62} 1"
$devpkey_PciDevice_RequiresReservedMemoryRegion = "{3AB22E31-8264-4b4e-9AF5-A8D2D8E33E62} 34"
$devpkey_PciDevice_AcsCompatibleUpHierarchy = "{3AB22E31-8264-4b4e-9AF5-A8D2D8E33E62} 31"
$devprop_PciDevice_DeviceType_PciConventional = 0