Instantly share code, notes, and snippets.

@tung
tung / twitch-vod-chat.py
Last active Oct 12, 2017
Download chat from a Twitch VOD and print it to a terminal.
View twitch-vod-chat.py
#!/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 Apr 26, 2018
Play Twitch VODs in mpv with chat replay in terminal
View twitch-vod.py
#!/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 Feb 3, 2016
Tomboy-like recent note list for Gnote Unity launcher icon right-click menu
View gnote-unity.py3
#!/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 Jul 31, 2014
Cataclysm 2 map.cpp coverage (20 steps left with 24-row and 55-row terminal windows)
View map-24.cpp.gcov
-: 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 Jul 9, 2014
.nethackrc for 'patches' branch of NAOHack (https://github.com/tung/NAOHack)
View .nethackrc
# 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 Feb 2, 2016
XChat script to gray/dim messages from certain users
View graymsg-0.1.6.pl
#!/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 Jun 11, 2012
SourceForge Trac float diff format switcher with page scroll
View trac-diff-float.js
// 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 Apr 4, 2012
NetHack 4 4.2.0 aimake build attempt on Ubuntu 11.10 (no PostgreSQL)
View aimake output.txt
[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 Dec 25, 2011
Automated update script(s) for byuu's phoenix GUI meta-toolkit on Linux
View check.py
#!/usr/bin/env python
# Print phoenix download URL if not already downloaded.
import urllib2
from BeautifulSoup import BeautifulSoup
import re
import glob
protocol = 'http'
@tung
tung / clean-youtube-front-page.css
Created Dec 2, 2011
Clean YouTube front page
View clean-youtube-front-page.css
/* Hide the homepage's sidebar. */
.guide-container { display: none !important; }
.guide-background { display: none !important; }
/* Hide recommended/promoted videos on the right. */
#video-sidebar { display: none !important; }
/* Widen the subscription feed for our newly-freed space. */
#feed {
margin-left: 0 !important;