Skip to content

Instantly share code, notes, and snippets.

View double-beep's full-sized avatar
🏠
Working from home

double beep double-beep

🏠
Working from home
View GitHub Profile
@double-beep
double-beep / BallotParser.js
Created January 6, 2024 11:39
A MeekSTV JavaScript implementation, licensed under MIT. Original Python implementation can be found at https://github.com/Conservatory/openstv
/**
* @typedef {{
* names: string[];
* numCandidates: number;
* numSeats: number;
* title: string;
* withdrawn?: number[];
* uniqueBallots: string[];
* uniqueBallotsWeight: number[];
* dirtyBallotsCount: number;
This file has been truncated, but you can view the full file.
[Event "London m2"]
[Site "London"]
[Date "1856.??.??"]
[Round "?"]
[White "Barnes, Thomas Wilson"]
[Black "Loewenthal, Johann Jacob"]
[Result "1-0"]
[ECO "C44"]
[PlyCount "49"]
[EventDate "1856.??.??"]
@double-beep
double-beep / old_suggested_edits.js
Created May 28, 2023 11:10
Fetches old suggested edits
const textify = id => `https://stackoverflow.com/suggested-edits/${id}`;
const url = new URL('https://api.stackexchange.com/2.3/suggested-edits');
const params = {
key: 'U4DMV*8nvpm3EOpvf69Rxw((', // SE key
site: 'stackoverflow',
pagesize: '100',
order: 'desc',
sort: 'creation',
filter: '!b)GQTHKTSeuf2h'
@double-beep
double-beep / ratings_scraper.js
Last active December 30, 2022 09:13
Scraps GM applications & GM norms and finds the people who earnt at least two in less than x days
// convert [[id1], [id2], [id3], ...] to { id1: [], id2: [], id3: [] }
// each empty array is filled later with norm information
const objectify = array => array.reduce((a, v) => ({ ...a, [v]: []}), {});
const players = {}; // {id: name}
function sortByDiff(entries) {
return entries
.filter(([, value]) => value.length > 1) // players with >1 GM norm
.map(([id, info]) => {
// convert YYYY-MM-DD to millis
@double-beep
double-beep / castling-out.pgn
Last active September 18, 2023 14:10
Games where 0-0 was played with e, g pawns unmoved
[Event "Zonal Vilnius"]
[Site "Vilnius"]
[Date "1975.08.??"]
[Round "9"]
[White "Bronstein, David Ionovich"]
[Black "Vasiukov, Evgeni"]
[Result "1/2-1/2"]
[ECO "B32"]
[PlyCount "46"]
[EventDate "1975.08.06"]
@double-beep
double-beep / waitForKeyElements.js
Last active February 8, 2024 21:19 — forked from BrockA/waitForKeyElements.js
A utility function, for Greasemonkey scripts, that detects and handles AJAXed content.
/* waitForKeyElements(): The improved utility function for userscripts - now with MutationObservers and no jQuery!
Usage example:
waitForKeyElements(
'div.comments',
element => console.log('Look! A new element appeared!', element)
);
// -----------------------------------------------------------------
// ==UserScript==
// @name StackFocus
// @namespace https://github.com/SpectricSO/stack-scripts
// @version 1.0.0+21AF26D3—-117B344092BD
// @author SpectricSO
// @contributor double-beep
// @match https://stackoverflow.com/*
// @resource Clear https://cdn.sstatic.net/Img/stacks-icons/Clear.svg
// @license MIT
// @grant GM_getValue
// ==UserScript==
// @name Generate Natty Reports
// @namespace https://github.com/SOBotics
// @version 1.0.0
// @author double-beep
// @match https://chat.stackoverflow.com/rooms/111347/*
// @run-at document-body
// @grant GM_addStyle
// @grant GM_xmlhttpRequest
// @grant GM_setClipboard
@double-beep
double-beep / fire_extra.user.js
Last active May 25, 2021 15:31
A userscript that addz some more buttonz to FIRE. See the instructions in the file for using it properly.
// ==UserScript==
// @name FIRE Additional Functionality
// @version 0.3.1
// @author double-beep
// @contributor Xnero
// @match https://chat.stackexchange.com/rooms/11540/charcoal-hq
// @resource whitelisted https://gist.githubusercontent.com/double-beep/db30adf42967187382d2d261bf0a2bc1/raw/whitelisted_domains.txt
// @resource redirectors https://gist.githubusercontent.com/double-beep/ef22d986621ade6cacadae604f20ee59/raw/redirectors.txt
// @grant GM_xmlhttpRequest
// @grant GM_addStyle
0i.is
bit.ly
clck.ru
clicky.com
firsturl.de
goo.gl
href.li
is.gd
lnkd.in
shorturl.at