Skip to content

Instantly share code, notes, and snippets.

@ephphatha
ephphatha / Source.cpp
Last active June 22, 2021 21:30
Testing LCG implementations based on the Borland constants as used in the Diablo video game
//#include <fstream>
#include <iomanip>
#include <iostream>
#include <random>
#include <map>
// The Diablo RNG is a Linear Congruential Generator using Borland C++ constants.
// These constants result in a chain across the entire interval [0, std::numeric_limits<uint32_t>::max()]
constexpr uint32_t multiplier = 0x015A4E35; //22695477
constexpr uint32_t increment = 1; // An increment of 0 would mean that the generator can never reach 0 from a non-zero
// ==UserScript==
// @name Baseball Tips Tracker
// @namespace https://thelettereph.com/
// @version 1.0
// @description Tracks baseball earnings and owed tips in OBL
// @author ephphatha
// @match *://politicsandwar.com/*
// @grant none
// ==/UserScript==
@ephphatha
ephphatha / pipetest.pl
Created September 5, 2018 08:23
quick and dirty test script to work out how reads on non-blocking pipes behave
#! /usr/bin/perl
use strict;
use warnings;
use feature qw(say);
use IO::Select;
use IO::Pipe;
@ephphatha
ephphatha / gps.ps1
Last active August 29, 2015 14:02
A script used to pull location information from .png files. Absolutely no error handling, needs imagemagick installed.
$images = Get-ChildItem -Name | Where-Object { $_ -match ".png$" }
if ($images) {
foreach ($image in $images) {
$gpstags = identify -format "%[EXIF:GPSL*]" $image
$latitude = 1
$longitude = 1
foreach ($tag in $gpstags) {
$tokens = $tag.split('=')
#! /usr/bin/perl -w
use strict;
use feature qw(say);
opendir my($dh), '/cygdrive/s/Videos/Movies' or die "Couldn't open Movies directory: $!";
my @files = grep(!/^\./, readdir $dh); #ignore dotfiles/pseudodirs
closedir $dh;