Skip to content

Instantly share code, notes, and snippets.

duganchen / go_style_libmpdclient.cpp
Last active Sep 5, 2021
A Go-style C++ wrapper for libmpdclient
View go_style_libmpdclient.cpp
#include <iostream>
#include <memory>
#include <mpd/client.h>
#include <string>
#include <tuple>
#include <vector>
namespace mpd {
using namespace std::string_literals;
View gist:777a6bc9465d115795780869901ac18d
Computer Information:
Manufacturer: Unknown
Model: Unknown
Form Factor: Desktop
No Touch Input Detected
Processor Information:
CPU Vendor: GenuineIntel
CPU Brand: Intel(R) Core(TM) i7-4770K CPU @ 3.50GHz
CPU Family: 0x6
duganchen /
Last active Aug 18, 2020
Clean duplicate songs from MPD's queue.
#!/usr/bin/env python3
# Dependencies:
# pip install python-musicpd
import musicpd
import collections
def main():
View FISH Profile with git prompt
Time Sum Command
3640 14814 > builtin source /usr/local/Cellar/fish/3.1.0/share/fish/
129 129 -> set -g IFS \n\ \t
47 47 -> set -qg __fish_added_user_paths
48 48 -> set -g __fish_added_user_paths
11 54 -> if not set -q __fish_initialized
set -U __fish_initialized 0
if set -q __fish_init_2_39_8
set __fish_initialized 2398
else if set -q __fish_init_2_3_0
View sdl2_gamepad_button_test.c
#include <stdio.h>
#include <stdlib.h>
#include <SDL2/SDL.h>
int main()
SDL_GameController *controller;
SDL_Event e;
int quit;

Fuzzy Finding Setup and MRU-based Directory Changer

There have been a lot of blog entries, lately, about setting yourself up with the FZF fuzzy finder. Here's mine.

It includes an implementation of autojump.


duganchen /
Last active Aug 30, 2021 prefix manager. For the FISH shell.

Wine Bottler

I've knocked up a system for managing WINE prefixes from the command-line. It's for FISH, because that's what I use, and it's reasonably versatile and maintainable.

Note 1: I'm going to use "prefix" and "bottle" interchangeably.

Note 2: This is for hardcore command-line users, and it's similar to tools like virtualenv and rbenv. Most people would probably want to use Lutris.


View kbleds.zsh
#!/usr/bin/env zsh
# Keyboard LED indicator for embedding into things like tint2, xmobar and dzen2.
# The order is Caps Lock, Num Lock, Scroll Lock
xset q | grep Caps | tr -s ' ' | cut -d ' ' -f 5,9,13 | sed 's/on/▣/g' | sed 's/off/▢/g'
# Or alternately:
# xset q | awk '/Caps/ {gsub("off", "▢"); gsub("on", "▣") ; print $4 " " $8 " " $12}'
View Logitech T650

Logitech T650 Gestures



  • Tap

Double Click

duganchen /
Last active Sep 27, 2020
#!/usr/bin/env python3
Python script that takes a directory, and displays files in that directory
tree with the same sizes, grouped by size.
Useful for hunting down duplicate files.
from argparse import ArgumentParser, ArgumentTypeError