Skip to content

Instantly share code, notes, and snippets.

Avatar

Mike Riebart

View GitHub Profile
@Riebart
Riebart / ffmpeg_side_by_side.sh
Created Nov 16, 2020
ffmpeg incantation for side-by-siding two videos of different resolutions and framerates.
View ffmpeg_side_by_side.sh
#!/bin/bash
ffmpeg \
-ss 90.75 -i "input1.mp4" \
-ss 0 -i "input2.mp4" \
-filter_complex "\
[0:v]setpts=PTS-STARTPTS,crop=iw/2:ih:iw/4:0[leftRaw];\
[1:v]setpts=PTS-STARTPTS,crop=iw/2:ih:iw/4:0[rightRaw];\
[leftRaw]scale=-1:1080[left];\
[rightRaw]scale=-1:1080[right];\
@Riebart
Riebart / state_scaling_by_election_power.wls
Created Nov 4, 2020
Wolfram code to generate a few maps that show election results, scaling states to show actual electoral power.
View state_scaling_by_election_power.wls
votesPerState = {{"Alabama", 9.`}, {"Alaska", 3.`}, {"Arizona",
11.`}, {"Arkansas", 6.`}, {"California", 55.`}, {"Colorado",
9.`}, {"Connecticut", 7.`}, {"Delaware",
3.`}, {"DistrictOfColumbia", 3.`}, {"Florida", 29.`}, {"Georgia",
16.`}, {"Hawaii", 4.`}, {"Idaho", 4.`}, {"Illinois",
20.`}, {"Indiana", 11.`}, {"Iowa", 6.`}, {"Kansas",
6.`}, {"Kentucky", 8.`}, {"Louisiana", 8.`}, {"Maine",
4.`}, {"Maryland", 10.`}, {"Massachusetts", 11.`}, {"Michigan",
16.`}, {"Minnesota", 10.`}, {"Mississippi", 6.`}, {"Missouri",
10.`}, {"Montana", 3.`}, {"Nebraska", 5.`}, {"Nevada",
@Riebart
Riebart / steam_library_completion_time.sh
Last active Nov 4, 2020
Scrape completion times from a Steam user library using howlongtobeat
View steam_library_completion_time.sh
#!/bin/bash
# DEPENDENCIES:
# - jq: https://stedolan.github.io/jq/
# - pup: https://github.com/EricChiang/pup
# - python-Levenshtein: https://pypi.org/project/python-Levenshtein/
# - You'll need a Steam API key, which you can get from https://steamcommunity.com/dev/apikey
# USAGE:
# This pulls in the full steam app list from the API, your user's game list via the Steam API,
@Riebart
Riebart / remarkable_find_update_device_id.py
Last active Dec 15, 2020 — forked from leezu/remarkable_find_update_device_id.py
Python script to rotate the machine IDs and OEM identifiers to find one that is eligible for a software update.
View remarkable_find_update_device_id.py
#!/usr/bin/env python3
import time
import uuid
import random
import re
import sys
import requests
@Riebart
Riebart / config.snipet
Created Mar 2, 2020
Ubiquiti EdgeRouter IPv6 router advert and prefix delegation config
View config.snipet
interfaces {
ethernet eth1 {
address 10.0.0.1/24
address 192.168.100.1/24
address ffff:ffff:ffff:ffff::1/64
address ffff:ffff:ffff:ffff::1/64
description Athens
duplex auto
firewall {
local {
@Riebart
Riebart / watch_fedex_package.sh
Created Mar 1, 2020
Watch a fedex package status via API calls
View watch_fedex_package.sh
#!/bin/bash
tracking_number="$1"
while [ true ]
do
date +%FT%T
echo -n "Tracking ${tracking_number} "
curl 'https://www.fedex.com/trackingCal/track' \
-s \
-H 'Connection: keep-alive' \
-H 'Pragma: no-cache' \
@Riebart
Riebart / .bashrc.aws
Created Oct 26, 2019
Collection of bashrc contents that makes it a bit easier to work across accounts
View .bashrc.aws
#!/bin/bash
# For non-256 colour terminals
#PS1='\[\e]0;\w\a\]\n\[\e[00;35m\]${AWS_PROFILE}$([ "$AWS_PROFILE" == "" ] && echo -n "" || echo -n " ")'
# The default region, if set
PS1=$PS1'\[\033[38;5;92m\]${AWS_DEFAULT_REGION}$([ "$AWS_DEFAULT_REGION" == "" ] || echo -n " ")'
# The AWS profile
PS1=$PS1'\[\e]0;\w\a\]\[\033[38;5;208m\]${AWS_PROFILE}$([ "$AWS_PROFILE" == "" ] || echo -n " ")'
# The existence of environment variables
@Riebart
Riebart / do.js
Created Sep 19, 2019
Nodejs script to convert Textract output into a PDF using PDFkit
View do.js
const fs = require('fs');
let rawdata = fs.readFileSync('/working/out4.json');
let data = JSON.parse(rawdata);
// You'll need to twiddle the dpi, page size, and font size to get your stuff to layout properly.
// Assumes uniform font size in the input.
let dpi = 200;
let width = 17 * dpi;
let height = 11 * dpi;
const PDFDocument = require('pdfkit');
@Riebart
Riebart / get_symlink_file_target.ps1
Created Jul 17, 2019
FInd the target of a file reparsepoint (such as those used for binaries in Store apps)
View get_symlink_file_target.ps1
@Riebart
Riebart / ms_store_python.wls
Last active Aug 31, 2021
Find all installed Python packages from the Microsoft store, determine install location, and register them as external evalautors.
View ms_store_python.wls
(* 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)