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
__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
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
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
#!/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
#!/usr/bin/env python3 | |
import os | |
import re | |
import sys | |
import shlex | |
import shutil | |
import argparse | |
import subprocess | |
import logging |
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 | |
def nums2ranges(nums): | |
""" | |
>>> list(nums2ranges([])) | |
[] | |
>>> list(nums2ranges([0, 1, 2, 3, 4])) | |
[slice(0, 5, None)] | |
>>> list(nums2ranges([0, 1, 4, 5, 6])) |
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
use warnings; | |
use strict; | |
use File::Basename qw(fileparse); | |
use File::Copy qw(cp mv); | |
###################################################################### | |
# Configuration # | |
###################################################################### |
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
# -*- coding: utf-8 -*- | |
""" | |
Plot the convex hull around a set of points as a | |
shaded polygon. | |
@author: Nicolas Guarin Zapata and Kaiwen | |
@date: February 6, 2023 | |
""" | |
import numpy as np | |
from scipy.spatial import ConvexHull |
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
# Require: [`fd`](https://github.com/sharkdp/fd.git) | |
PATTERN='XXX' # Assume this would be a directory | |
fd -0 -td "$PATTERN" \ | |
| xargs -0 du -sh \ | |
| numfmt --from=auto --to=none \ | |
| perl -ane 'BEGIN { my $sum = 0; } $sum += $F[0]; print; END { print $sum, " totoal\n"; }' \ | |
| numfmt --from=none --to=si |