Skip to content

Instantly share code, notes, and snippets.

@duganchen
duganchen / go_style_libmpdclient.cpp
Last active September 5, 2021 19:27
A Go-style C++ wrapper for libmpdclient
#include <iostream>
#include <memory>
#include <mpd/client.h>
#include <string>
#include <tuple>
#include <vector>
namespace mpd {
using namespace std::string_literals;
@duganchen
duganchen / gist:777a6bc9465d115795780869901ac18d
Created March 19, 2021 03:28
My Steam system information
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
duganchen / clean_mpd_queue.py
Last active August 18, 2020 20:54
Clean duplicate songs from MPD's queue.
#!/usr/bin/env python3
# Dependencies:
# pip install python-musicpd
import musicpd
import collections
def main():
@duganchen
duganchen / FISH Profile with git prompt
Created February 18, 2020 22:05
FISH startup times on OS X
Time Sum Command
3640 14814 > builtin source /usr/local/Cellar/fish/3.1.0/share/fish/config.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
#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.

Components

@duganchen
duganchen / wine_bottler.md
Last active May 14, 2023 20:27
tter.com/WINE 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.

Anyway...

#!/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}'

Logitech T650 Gestures

Gestures

Click

  • Tap

Double Click

@duganchen
duganchen / dupe_files.py
Last active May 30, 2022 22:51
dupe_files.py
#!/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