Skip to content

Instantly share code, notes, and snippets.

View jessestricker's full-sized avatar
:shipit:
do it

Jesse Stricker jessestricker

:shipit:
do it
  • 21:33 (UTC +02:00)
View GitHub Profile
@jessestricker
jessestricker / do_purge.sh
Last active October 22, 2020 00:01
List and interactively purge all non-important APT packages.
#!/bin/bash
pkgs=$(./list_purgable.py)
for pkg in $pkgs; do
echo "$(tput setaf 6)purging $pkg$(tput sgr0)"
sudo apt purge "$pkg" || sudo apt-mark manual "$pkg"
done
@jessestricker
jessestricker / greasemonkey_cppreference_setCppStandard.js
Created January 24, 2022 15:26
Greasemonkey Userscript to set the C++ standard on cppreference.com
// ==UserScript==
// @name Set C++ standard on cppreference.com
// @match https://en.cppreference.com/w/cpp/*
// @icon https://en.cppreference.com/favicon.ico
// ==/UserScript==
const DESIRED_CPP_STANDARD = "C++20";
function changeCppStandard(elem) {
// find option labeled with DESIRED_CPP_STANDARD
@jessestricker
jessestricker / splash.bash
Last active August 3, 2022 16:38
Get a Random Wallpaper from Unsplash!
#! /usr/bin/env bash
set -e -u -o pipefail
# set options
COLLECTION_ID='317099' # Unsplash Editorial (aka Picture of the Day)
# set constants
IMG_RESOLUTION=$(xrandr --current | grep '\*' | awk '{print $1}' | sort | tail -n 1)
IMG_REMOTE_URI="https://source.unsplash.com/collection/${COLLECTION_ID}/${IMG_RESOLUTION}"
@jessestricker
jessestricker / README.md
Last active August 7, 2022 23:38
A collection of reusable bash code.

bashlib

A collection of reusable bash code.

  • log: logging library
@jessestricker
jessestricker / color.go
Created September 21, 2022 17:50
Hexe Color Model
package hexe
import (
"math"
hsluv "github.com/hsluv/hsluv-go"
)
// Color defines an 8-bit packed color value in the HSLuv color space.
type Color uint8
[CmdletBinding()]
param (
[Parameter(Mandatory)]
[string] $Path,
[Parameter(Mandatory)]
[string] $Hash,
[ValidateSet("SHA1", "SHA256", "SHA512")]
[string] $Algorithm = "SHA256"
@jessestricker
jessestricker / Microsoft.PowerShell_profile.ps1
Last active October 13, 2022 10:59
Windows PowerShell Profile
function Test-FileHash {
[CmdletBinding()]
param (
[Parameter(Mandatory)]
[string] $Path,
[Parameter(Mandatory)]
[string] $Hash,
[ValidateSet("SHA1", "SHA256", "SHA512")]
@jessestricker
jessestricker / VMware Workstation Player VM Config.md
Last active November 22, 2022 10:35
VMware Workstation configuration options, not available via GUI in the free Player variant.

VMware Workstation Player VM Config

Add the following lines to the .vmx file, which describes the VM.
These settings were tested with VMware Workstation Player v17.

VMX Reference (slightly outdated)

5-Button Mouse

@jessestricker
jessestricker / football_betting_points.py
Created January 7, 2023 21:20
Calculates the awarded points for a football betting game.
from builtins import int, tuple, max
Result = tuple[int, int]
def points(game: Result, bet: Result) -> int:
"""
Calculates the awarded points for a given game result and bet.
- If the bet is exactly the same as the game result, 10 points are awarded.