Skip to content

Instantly share code, notes, and snippets.

View luavixen's full-sized avatar
🦊
teehee! :3c

Lua MacDougall luavixen

🦊
teehee! :3c
View GitHub Profile
@luavixen
luavixen / foxblock.js
Created January 4, 2023 08:02
Tumblr userscript to automatically mass block users, visit your blog's settings to open the UI.
// ==UserScript==
// @name FoxBlock
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Tumblr userscript to automatically mass block users.
// @author [email protected]
// @match https://*.tumblr.com/*
// @grant unsafeWindow
// ==/UserScript==
@luavixen
luavixen / mastodownload.js
Last active December 22, 2022 01:42
Mirrors posts from federated users to your instance.
//
// Mastodownload v1.1
// Mirrors posts from federated users to your instance.
//
// Requires Node.js 18 or higher.
//
// Usage:
// $ mkdir mastodownload && cd mastodownload
// $ wget 'https://gist.githubusercontent.com/luavixen/347cfff0038b159da51496d73ad6a09d/raw/mastodownload.js'
// $ npm install debug
@luavixen
luavixen / friends.js
Last active September 22, 2022 07:09
Twitter userscript to display a "friends" (accounts that you follow that also follow a given account) count next to usernames.
// ==UserScript==
// @name Twitter Friend Counter
// @namespace http://tampermonkey.net/
// @version 0.2
// @description Twitter userscript to display a "friends" (accounts that you follow that also follow a given account) count next to usernames.
// @author [email protected]
// @match https://twitter.com/*
// @grant unsafeWindow
// ==/UserScript==
@luavixen
luavixen / fixmodtime.js
Created February 14, 2022 22:16
Node.js script to fix modification times for directories which have been moved between filesystems.
const paths = require('path');
const fs = require('fs').promises;
async function time(path)
{
const { mtime, birthtime } = await fs.stat(path);
if (mtime.getTime() > birthtime.getTime())
{
return mtime;
@luavixen
luavixen / fandom.ublock
Created February 7, 2022 15:33
uBlock Origin rules that make Fandom (fandom.com) feel more like a normal wiki site.
fandom.com##.global-navigation
fandom.com##.main-container:style(margin: 0 !important; width: 100% !important)
fandom.com##.fandom-sticky-header:style(left: 0 !important)
fandom.com##.top-ads-container
fandom.com##.bottom-ads-container
fandom.com##.page__right-rail
fandom.com###mixed-content-footer
fandom.com##.notifications-placeholder
fandom.com###WikiaBar
fandom.com##.wds-global-footer__bottom-bar
@luavixen
luavixen / Table.java
Last active January 27, 2022 10:48
Fast and complete implementation of java.util.Map using open addressing.
package java.util;
import java.io.Serial;
import java.io.Serializable;
import java.util.*;
public class Table<K, V> implements Map<K, V>, Serializable {
@Serial
private static final long serialVersionUID = -534207388696845484L;
@luavixen
luavixen / expand-new-arch-wiki.ublock
Last active February 7, 2022 15:32
uBlock Origin rules that make the new Arch Linux Wiki take up your whole screen instead of being squished into the middle.
! 2021-12-22 https://wiki.archlinux.org
wiki.archlinux.org##.mw-page-container:style(max-width: unset !important)
wiki.archlinux.org##.mw-workspace-container:style(max-width: unset !important)
wiki.archlinux.org##.mw-content-container:style(max-width: unset !important; margin-left: 11.5em !important)
wiki.archlinux.org##.mw-article-toolbar-container:style(max-width: unset !important)
wiki.archlinux.org###mw-navigation:style(margin-left: 11.5em !important)
wiki.archlinux.org###mw-panel:style(transform: none !important; visibility: visible !important; opacity: 1 !important)
wiki.archlinux.org##.archwiki-template-meta-related-articles-start:style(width: unset !important; max-width: 25% !important)
@luavixen
luavixen / Curry.kt
Created November 27, 2021 00:13
Generic Haskell/functional style currying in Kotlin using extension functions. Example: https://pl.kotl.in/LuUAPZxOV
operator fun <T : (A0) -> R, R, A0> T.invoke(): (A0) -> R {
return { a -> this(a) }
}
operator fun <T : (A0, A1) -> R, R, A0, A1> T.invoke(): (A0, A1) -> R {
return { a, b -> this(a, b) }
}
operator fun <T : (A0, A1, A2) -> R, R, A0, A1, A2> T.invoke(): (A0, A1, A2) -> R {
return { a, b, c -> this(a, b, c) }
}
operator fun <T : (A0, A1, A2, A3) -> R, R, A0, A1, A2, A3> T.invoke(): (A0, A1, A2, A3) -> R {
@luavixen
luavixen / mirrorbench.js
Last active December 15, 2021 08:11
Node.js script to find the fastest Arch Linux mirrors.
const target = '/core/os/x86_64/linux-firmware-20210818.c46b8c3-1-any.pkg.tar.zst';
const targetReplace = '/$repo/os/$arch';
const timeoutMs = 20_000;
const mirrors = [
// Canada
'https://mirror.0xem.ma/arch/$repo/os/$arch',
'https://mirror.csclub.uwaterloo.ca/archlinux/$repo/os/$arch',
'https://mirror2.evolution-host.com/archlinux/$repo/os/$arch',
@luavixen
luavixen / blaze.c
Last active April 18, 2021 19:21
Speedy Brainfuck interpreter with a convienent REPL.
#include <stddef.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <setjmp.h>
#include <errno.h>
#include <unistd.h>
#include <readline/readline.h>