Skip to content

Instantly share code, notes, and snippets.

View Riebart's full-sized avatar

Mike Riebart

View GitHub Profile
@Riebart
Riebart / steam_library_completion_time.sh
Last active November 4, 2020 06:24
Scrape completion times from a Steam user library using howlongtobeat
#!/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 / state_scaling_by_election_power.wls
Created November 4, 2020 22:47
Wolfram code to generate a few maps that show election results, scaling states to show actual electoral power.
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 / ffmpeg_side_by_side.sh
Created November 16, 2020 04:31
ffmpeg incantation for side-by-siding two videos of different resolutions and framerates.
#!/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 / 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 / syslog_levels.md
Created December 4, 2020 16:24
Documentation on the syslog levels and facilities, and how to use them when building application logging

Syslog logging levels and parameters

All logs

All logs should contain the following information, preferably encoded in JSON so that it is easily machine-parsable as well as human readable. Graylog can parse JSON, so encoding your fields in that way makes it easy to alert and filter on messaged components.

  • Message: The message should be a plaintext description of the event, optionally including an application-unique code.
  • Impact: This field should describe the impact, if any (there is no impact for debug and informational events), on the state, output, and resiliency of the application. It should be short (one sentence), but contain enough information for someone not familiar with the application to triage the event.
  • Correction: This field should describe any corrective action, if any (there is no corrective action required for debug, informational, and notice level events), that could, or should, be taken to resolve the impacts caused by the event. This should be short (at most two sentences) an
@Riebart
Riebart / reconnect_console.ps1
Created January 5, 2021 18:18
Disconnect the first active session on Windows and reconnect the console session. Useful for disconnecting RDP to use Steam Streaming.
$session=(query session | select-string Active)[0].ToString().split(" ")[0].substring(1)
Start-Process -verb runas tscon -ArgumentList "$session /dest:console"
@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 / read_process_mem.py
Created January 29, 2021 22:51
Adapted from Stackoverflow, a Python script to dump the memory of a process.
#!/usr/bin/env python
# Source: https://stackoverflow.com/questions/12977179/reading-living-process-memory-without-interrupting-it
#
# Adapted to be python3
import os
import re
import sys
#
# 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
@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