Skip to content

Instantly share code, notes, and snippets.

View Xunnamius's full-sized avatar
🐕

Bernard Xunnamius

🐕
View GitHub Profile
@Xunnamius
Xunnamius / mersenne-twister.js
Created May 21, 2024 23:19 — forked from banksean/mersenne-twister.js
a Mersenne Twister implementation in javascript. Makes up for Math.random() not letting you specify a seed value.
/*
I've wrapped Makoto Matsumoto and Takuji Nishimura's code in a namespace
so it's better encapsulated. Now you can have multiple random number generators
and they won't stomp all over eachother's state.
If you want to use this as a substitute for Math.random(), use the random()
method like so:
var m = new MersenneTwister();
@Xunnamius
Xunnamius / gh-cleanup-release-tags.sh
Last active November 24, 2024 15:32 — forked from joejordanbrown/gh-cleanup-releases-tags.sh
GitHub cli - delete all releases and tags in a repo
#! /bin/sh
# Note that gh! is an alias for gh
for release in $(gh! release list 2>/dev/null | awk '{print $1}'); do
if gh! release delete $release -y | cat; then
echo '✓ Deleted release' $release
else
echo '⤫ FAILED to delete release' $release
fi
done
@Xunnamius
Xunnamius / gh-renovate-old-style-tags-into-scoped-tags.sh
Last active November 10, 2024 03:46
Takes the old-style "v$version" tags and creates aliases to the same commits using monorepo-safe scoped tags (e.g. "my-package@$version" and "@my/package@$version"
#! /bin/sh
# Note that gh! is an alias for gh
# v1.0.0 is the old-style tag, @package/[email protected] is the monorepo-safe version
git tag -m 'alias => v1.0.0' '@package/[email protected]' 'v1.0.0^{}'
@Xunnamius
Xunnamius / gh-prune-upstream-tags.sh
Last active November 24, 2024 15:07
Clean up any tag mess when fetching from upstream when you're operating on a downstream fork
# Clean up the mess of tags that came in from upstream
git push upstream --delete $(git ls-remote --tags upstream | grep "YOUR_TAG_PREFIX_HERE.*[^}]$" | cut -f 2)
# Depending on the use case and tag format, other forms may be more appropriate, e.g.:
git tag --delete $(git ls-remote --tags upstream | cut -f 2 | cut -f 3 -d /)
# Stop git from pulling tags from upstream in the future
git config remote.upstream.tagopt --no-tags
@Xunnamius
Xunnamius / colortest.py
Last active January 14, 2025 10:32 — forked from justinabrahms/colortest.py
Small utility to test terminal support for 256-color output. Updated for Python 3.
#!/usr/bin/env python
# Ported to Python from http://www.vim.org/scripts/script.php?script_id=1349
print("Color indexes should be drawn in bold text of the same color.")
print()
colored = [0] + [0x5f + 40 * n for n in range(0, 5)]
colored_palette = [
"%02x/%02x/%02x" % (r, g, b)
for r in colored
@Xunnamius
Xunnamius / fake-news-blocker.js
Created January 18, 2025 16:34
Block fake news from appearing on currentstatus.io (a tampermonkey script)
// ==UserScript==
// @name Fake News Blocker
// @namespace http://tampermonkey.net/
// @version 2024-04-04
// @description try to take over the world!
// @author You
// @match https://currentstatus.io/
// @icon https://www.google.com/s2/favicons?sz=64&domain=currentstatus.io
// @grant none
// ==/UserScript==