Skip to content

Instantly share code, notes, and snippets.

View Riebart's full-sized avatar

Mike Riebart

View GitHub Profile
@Riebart
Riebart / code_flows.md
Last active October 26, 2023 00:03
Thoughts on git branch workflows and microservice code organization

Comparing branching and workflow strategies

Summary of existing

There's several existing strategies for deploying and managing development work and release. They each have their own opinions, but roughly cover a few major situations:

  • Developing a new feature
  • Which branches should be, at all times, deployable, tested code
  • Under what conditions a code review or approval is required to merge code into a new branch
  • How many deployment environments (e.g. production only, or staging and production) you intend to have available, and to whom
@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 / ms_store_python.wls
Last active September 2, 2023 04:16
Find all installed Python packages from the Microsoft store, determine install location, and register them as external evalautors.
(* Run this every time the Python from the Store updates, since the binary location encodes the store full version *)
(* Note that Python 3.9 is supported in Mathematica 12.3.1, so the below patches are not relevant on modern versions, but are retained to aid those running older versions from perpetual licenses *)
(* Update to support Mathematica 12, which requires that Python >=3.8 at least reference python3.8.exe, not python.exe. *)
(* Note, python >3.7 is not officially supported in Mathematica 12.0.0, and other notebook interfaces.
Attempts to use it result in a "required field 'type_ignores' missing from module" error
Source: https://mathematica.stackexchange.com/questions/211984/solved-externalevaluatepysys-pycmd-evaluates-to-failure *)
(*
A patch to C:\Program Files\Wolfram Research\Mathematica\12.0\SystemFiles\Links\WolframClientForPython\wolframclient\utils\externalevaluate.py to enable 3.8:
66c66
< exec(compile(ast.Module(expressions, []), '', 'exec'), current)
@Riebart
Riebart / apigateway-invoke.py
Last active May 30, 2023 12:21
Python script to invoke an AWS API Gateway endpoint that requires IAM authentication. Uses boto for signing the request, and requests for issuing it.
#!/usr/bin/env python3
"""
Provides a simple Python wrapper for invoking an API Gateway endpoint using IAM signed requests.
Example:
python3 apigateway-invoke.py GET \
https://xxxxxxxxxx.execute-api.us-east-1.amazonaws.com/default/MethodName | jq .
"""
try:
@Riebart
Riebart / userdata.sh
Created January 10, 2018 16:51
EC2 user data for setting up an EC2 instance with SSM and deploying into an ECS cluster.
#!/bin/bash
# Install the SSM agent:
# Ref: https://docs.aws.amazon.com/systems-manager/latest/userguide/sysman-install-startup-linux.html
cd /tmp
sudo yum install -y https://s3.amazonaws.com/ec2-downloads-windows/SSMAgent/latest/linux_amd64/amazon-ssm-agent.rpm
sudo start amazon-ssm-agent
echo ECS_CLUSTER="ECS_CLUSTER_NAME" >> /etc/ecs/ecs.config
export PATH=/usr/local/bin:$PATH
@Riebart
Riebart / 3dmsearch.py
Last active November 3, 2022 10:41
Search through 3DMark results for all results for a specific GPU. Search result pagination is done by score.
#!/usr/bin/env python3
# GPU Search by string:
# "https://www.3dmark.com/proxycon/ajax/search/gpuname?term=" + s
import json
import requests
import time
import sys
@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;