Skip to content

Instantly share code, notes, and snippets.

@duganchen
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
duganchen / clean_mpd_queue.py
Last active Aug 18, 2020
Clean duplicate songs from MPD's queue.
View clean_mpd_queue.py
#!/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/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
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;
View fzf_autojump_setup.md

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 Aug 30, 2021
tter.com/WINE prefix manager. For the FISH shell.
View wine_bottler.md

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...

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 Gestures.md

Logitech T650 Gestures

Gestures

Click

  • Tap

Double Click

@duganchen
duganchen / dupe_files.py
Last active Sep 27, 2020
dupe_files.py
View 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