Skip to content

Instantly share code, notes, and snippets.

@tung
tung / userChrome.css
Last active October 31, 2023 04:35
Firefox 89 Proton-to-Photon square-style tab adaptation
@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");
/**
* Firefox 89 Proton-to-Photon square-style tab adaptation.
*
* Set browser.compactmode.show = true in about:config, since I only tested this with it on.
*
* This will probably break at some point, but we'll worry about that when the time comes.
*/
@tung
tung / twitch-vod-chat.py
Last active March 10, 2023 10:34
Download chat from a Twitch VOD and print it to a terminal.
#!/usr/bin/env python3
#
# A script to download chat from a Twitch VOD and print it to a terminal.
# Chat will be downloaded all the way until it ends.
#
# Usage: TWITCH_CLIENT_ID=0123456789abcdef0123456789abcde twitch-vod-chat.py [video_id] [start]
#
# This script could break at any time, because Twitch's chat API is
# undocumented and likes to change at any time; in fact, this script was
@tung
tung / twitch-vod.py
Last active February 27, 2023 02:33
Play Twitch VODs in mpv with chat replay in terminal
#!/usr/bin/env python3
#
# Twitch VOD viewer with terminal chat replay.
#
# Usage: TWITCH_CLIENT_ID=0123456789abcdef0123456789abcde twitch-vod.py https://www.twitch.tv/videos/1234567890 [360p]
#
# Requires mpv and twitch-vod-chat.py - https://gist.github.com/tung/20de3e992ca3a6629843e8169dc0398e
#
@tung
tung / gnote-unity.py3
Created February 3, 2016 11:44
Tomboy-like recent note list for Gnote Unity launcher icon right-click menu
#!/usr/bin/env python3
#
# gnote-unity.py3
#
# Shows a Tomboy-like list of recent notes when the Gnote launcher is right-clicked.
# Clicking on a note opens it.
# Notes are sorted by last modification time and update dynamically.
#
# To use, just run this at login time, e.g. set under Startup Applications.
@tung
tung / map-24.cpp.gcov
Created July 31, 2014 12:23
Cataclysm 2 map.cpp coverage (20 steps left with 24-row and 55-row terminal windows)
-: 0:Source:map.cpp
-: 0:Graph:obj/map.gcno
-: 0:Data:obj/map.gcda
-: 0:Runs:1
-: 0:Programs:1
-: 1:#include "field.h"
-: 2:#include "map.h"
-: 3:#include "rng.h"
-: 4:#include "globals.h"
-: 5:#include "monster.h"
@tung
tung / .nethackrc
Created July 9, 2014 12:46
.nethackrc for 'patches' branch of NAOHack (https://github.com/tung/NAOHack)
# temporary
msgtype=hide "You are blasted by * power!"
###############################################################################
# $Id: stth.nh343rc,v 343.331 2014/04/12 17:54:45 st-th Exp $
#
# NetHack 3.4.3 configuration file for public servers. It is meant to be used
@tung
tung / graymsg-0.1.6.pl
Last active February 2, 2016 08:19
XChat script to gray/dim messages from certain users
#!/usr/bin/perl
#
# graymsg-0.1.6.pl - color messages from certain users gray
#
# Change the nicks array to customize.
use strict;
use warnings;
my @supernicks = (
@tung
tung / trac-diff-float.js
Created June 11, 2012 04:42
SourceForge Trac float diff format switcher with page scroll
// Set to autorun on sourceforge\.net\/.*/trac/.*/changeset/
(function ($) {
var mods = $("#file-legend .mod + dd");
if (mods.length == 0) return;
var modsLen = parseInt(mods[0].textContent);
if (!modsLen) return;
// Cache diff dimensions.
var tops = new Array(modsLen);
@tung
tung / aimake output.txt
Created April 4, 2012 05:09
NetHack 4 4.2.0 aimake build attempt on Ubuntu 11.10 (no PostgreSQL)
[tung@tung-901 ~/Install/nethack4-4.2.0/build/aimake]$ ../../aimake ../../
Use of "goto" to jump into a construct is deprecated at ../../aimake line 1057.
Use of "goto" to jump into a construct is deprecated at ../../aimake line 1057.
Use of "goto" to jump into a construct is deprecated at ../../aimake line 1057.
Use of "goto" to jump into a construct is deprecated at ../../aimake line 1057.
Use of "goto" to jump into a construct is deprecated at ../../aimake line 1057.
Use of "goto" to jump into a construct is deprecated at ../../aimake line 1057.
Use of "goto" to jump into a construct is deprecated at ../../aimake line 1057.
Use of "goto" to jump into a construct is deprecated at ../../aimake line 1057.
Use of "goto" to jump into a construct is deprecated at ../../aimake line 1057.
@tung
tung / check.py
Created December 25, 2011 07:31
Automated update script(s) for byuu's phoenix GUI meta-toolkit on Linux
#!/usr/bin/env python
# Print phoenix download URL if not already downloaded.
import urllib2
from BeautifulSoup import BeautifulSoup
import re
import glob
protocol = 'http'