Skip to content

Instantly share code, notes, and snippets.

View stpettersens's full-sized avatar

Sam Saint-Pettersen stpettersens

View GitHub Profile
@stpettersens
stpettersens / KeyBindings.ahk
Last active June 13, 2025 20:34
Key binding script for AutoHotKey I use in conjunction with GlazeWM but will work independently of it, should I close GlazeWM.
^+a:: {
MsgBox "Key bindings are active."
Return
}
!Enter:: {
Run "wt.cmd"
Return
}
@stpettersens
stpettersens / genisoimage.cmd
Last active May 27, 2025 17:10
Thin wrapper command around genisoimage.exe from Cygwin x64.
@echo off
@C:\Dev\cygwin64\bin\genisoimage.exe %*
@stpettersens
stpettersens / thread_demo.d
Last active September 13, 2024 18:10
Demonstrate threads and signals in D (dlang).
// Demonstrate threads and signals in D (dlang).
import std.stdio;
import core.thread;
shared bool g_Running = true;
version(Windows) {
import core.sys.windows.windows;
extern(Windows) BOOL CtrlHandler(DWORD fdwCtrlType) nothrow {
@stpettersens
stpettersens / build-reicast-deb.sh
Last active May 1, 2020 14:25 — forked from bmaupin/build-reicast.sh
Build Reicast emulator on Ubuntu/Debian
# Install prerequisites
sudo apt-get -y install build-essential libasound2 libasound2-dev libegl1-mesa-dev libgl1-mesa-dev libgles2-mesa-dev mesa-common-dev libudev-dev
# Build Reicast
git clone https://github.com/reicast/reicast-emulator.git
cd reicast-emulator
git checkout master # Make sure on 'master' branch so will find the necessary subdir (not in alpha branch).
cd shell/linux
make
# Run Reicast
@stpettersens
stpettersens / github-search-toggler.user.js
Last active September 14, 2017 19:46
User script to toggle between a global search and repo searches on GitHub.
// ==UserScript==
// @name GitHub SearchToggler
// @namespace 87901be6f9d184fd17613010a80448e2
// @version 0.2
// @description Toggle between a global search and repo searches on GitHub.
// @author Sam Saint-Pettersen <[email protected]>
// @match https://github.com/*
// @icon https://github.com/favicon.ico
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js
// ==/UserScript==
// ==UserScript==
// @name Duolingo Trim tree
// @namespace 9a84a9d7b3fef7de9d2fd7155dcd794c
// @description Hides all golden skills with a button.
// @author Arek Olek
// @match https://www.duolingo.com/*
// @icon https://s32.postimg.org/8zxj3evit/duolingo.png
// @grant GM_getValue
// @grant GM_setValue
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js
@stpettersens
stpettersens / ecosia-trees.user.js
Last active September 14, 2017 19:39
User script to display estimated number of trees planted with Ecosia.
// ==UserScript==
// @name Ecosia Trees Planted
// @namespace 481487dd5200e3aa69b16a9d80fa5f75
// @version 0.3
// @description Display estimated number of trees planted with Ecosia.
// @author Sam Saint-Pettersen <[email protected]>
// @match https://www.ecosia.org/*
// @icon https://s2.postimg.org/407qv942h/small-tree-icon-0.jpg
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js
// ==/UserScript==
@stpettersens
stpettersens / Dockerfile
Last active July 20, 2017 14:06
Dockerfile for a Node.js-based application; based on @phusion 's base-image.
#
# Dockerfile for a Node.js-based application; derived from @phusion's container
# (Docker optimized Ubuntu 16.04 LTS system phusion/base-image:latest container
# - https://github.com/phusion/baseimage-docker/blob/master/image/Dockerfile).
#
# saintpettersens/docker-nodejs
#
FROM phusion/baseimage:latest
@stpettersens
stpettersens / talkingclock.rs
Last active July 23, 2017 12:24
A /r/dailyprogrammer challenge.
/*
Talking clock
Command line application which says the time.
Copyright 2017 Sam Saint-Pettersen.
Released under the MIT License.
*/
extern crate clioptions;
extern crate litepattern;
@stpettersens
stpettersens / paintcalc.rs
Last active June 23, 2017 21:40
Utility to calculate the volume of paint needed to paint a room of supplied dimensions [in Rust].
/*
Utility to calculate the volume of paint needed to
paint a room of supplied dimensions.
Sam Saint-Pettersen, 2017.
*/
extern crate clioptions;
use clioptions::CliOptions;
use std::io::stdin;
use std::process::exit;