This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
set -o pipefail | |
fd -g -td \*.app /System/Library/CoreServices /System/Applications /Applications . \ | |
| fzf --multi --exact --query="$1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import argparse | |
import collections | |
import tempfile | |
import zipfile | |
import filecmp | |
import shutil | |
import shlex | |
ZipCmpResult = collections.namedtuple('ZipCmpResult', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from __future__ import print_function | |
import argparse | |
import os | |
import ast | |
import sys | |
import pkgutil | |
import itertools | |
import logging | |
import json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
__all__ = [ | |
'cjkljust', | |
'cjkrjust', | |
'cjkcenter', | |
] | |
import unicodedata | |
#def cjklen(string): | |
# return sum(2 if unicodedata.east_asian_width(char) in 'FW' else 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import math | |
import itertools | |
import shutil | |
# https://gist.github.com/kkew3/8bb9aa225a6c82ae5e1a0fa609c9a65a | |
import cjkjust | |
def calc_layout(n_strings, total_width, column_width, width_between_cols): | |
# expected_ncols * column_width + |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "rbtree.h" | |
rbnode *left_rotate(rbnode *x) | |
{ | |
// assert(x && x->right); | |
rbnode *y = x->right; | |
x->right = y->left; | |
y->left = x; | |
return y; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# original command adapted from https://superuser.com/a/100290 | |
import subprocess | |
filename = ... | |
try: | |
_ = subprocess.check_call(['ffmpeg', '-v', 'error', '-i', | |
filename, '-f', 'null', '-']) | |
except subprocess.CalledProcessError: | |
# the subprocess call returns non-zero, which means filename |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import os | |
import sys | |
import argparse | |
import subprocess | |
import ast | |
HOMEDIR = os.path.normpath(os.environ['HOME']) | |
MUSICDIR = os.path.join(HOMEDIR, 'Music') | |
COVERARTDIR = os.path.join(MUSICDIR, '.cover-arts') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
SLICE_TEMPLATES = [ | |
('s', r'(?P<i>[+-]?\d+)'), | |
('sp', r'\((?P<i>[+-]?\d+)\)'), | |
('a', r'::?'), | |
('ri-', r'(?P<i>[+-]?\d+)::?'), | |
('ri-k', r'(?P<i>[+-]?\d+)::(?P<k>[+-]?\d+)'), | |
('r-j', r':(?P<j>[+-]?\d+):?'), | |
('r-jk', r':(?P<j>[+-]?\d+):(?P<k>[+-]?\d+)'), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# this command list attached volumes; make sure the volume to mount | |
# is in the list | |
lsblk | |
# see if the volume contains file system (skipped if for sure). | |
# the name of the volume is denoted here as `/dev/xvdf', which | |
# should be listed in the output of `lsblk'. | |
# If the output is `/dev/xvdf: data', then it does not have |