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
# https://stackoverflow.com/q/65964916 | |
# Usage: awk -v limit=17577 -f prog.awk file | |
BEGIN { | |
RS = ORS = "," | |
} | |
{ | |
nread++ | |
} |
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 - | |
gen_sfx() | |
case $ext in | |
(/*|*//*|*/) | |
printf '%q: %q: Invalid specifier\n' "$0" "$ext" >&2 | |
exit 3 ;; | |
(*/*) | |
local - IFS=/ | |
set -f |
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/sh - | |
find . \ | |
-type f \ | |
-name '[A-Z]*' \ | |
! -name '*[!0-9A-Za-z]*.*' \ | |
-exec sh -c ' | |
for pn; do | |
p=${pn%/*}/ | |
fn=${pn#"$p"} | |
n=${fn%.*} |
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
LC_ALL=C | |
case $1 in | |
''|[!0-9]*|[!0]*[!0-9]*|0[!0-7Xx]*|0[Xx]|0[!Xx]*[!0-7]*|0[Xx]*[!0-9A-Fa-f]*) | |
printf '%s: invalid number: %s\n' "$0" "$1" >&2 | |
exit 1 | |
esac | |
x=$(($1)) bx= | |
while test $x -gt 0; do |
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
def tree($pre; $in): | |
def root($pre; $in): | |
def branch($pre; $in): | |
$in | if has(0) then | |
(index($pre[0]) + 1) as $i | { | |
l: root($pre[:$i]; .[:$i]), | |
r: root($pre[$i:]; .[$i:]) | |
} | |
else | |
{l: {}, r: {}} |
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
BEGIN { | |
FS = ": " | |
} | |
$1 == "Package" { | |
pkg = $2 | |
tab[pkg][""] | |
} | |
$1 == "Status" { |
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
{ | |
item[NR] = $0 | |
itemw[NR] = length | |
} | |
END { | |
if (NR == 0) | |
exit | |
if (width == 0) |
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
printf '%s\n' "$@" \ | |
| awk ' | |
{ | |
sub(/boards\.4chan(nel)?/, "a.4cdn") | |
print "url=" $0 ".json" | |
} | |
' \ | |
| curl -sS -K - -w '"%{url}"' \ | |
| jq -nr ' | |
def url($board): |
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
err_usage() { | |
printf 'Usage: %s [-c columns] [-o outfile] image image...\n' "$0" >&2 | |
exit 1 | |
} | |
columns=0 | |
out_file=images.jpg | |
while getopts :c:o: opt; do | |
case $opt in |
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
err_usage() { | |
printf 'Usage: %s [-l] [-n name] [-c comment] image\n' "$0" >&2 | |
exit 1 | |
} | |
name=Custom | |
comment= | |
light_theme=0 | |
while getopts :n:c:l opt; do |
OlderNewer