This file contains hidden or 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 | |
# Practice Chinese Numbers from 0 to 10 (in Pinyin) | |
# Copyright (C) 2012 Matous J. Fialka, <http://mjf.cz/> | |
# Released under the terms of The MIT License | |
# | |
# Note: requires UTF-8 ANSI-compatible terminal (XTerm) | |
hanzi[0]='零' | |
hanzi[1]='一' |
This file contains hidden or 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 | |
# ASCIIPS - ASCII file to PostScript Converter | |
# Copyright (C) 2012 Matous J. Fialka, <http://mjf.cz/> | |
# Released under the terms of The MIT License | |
ASCIIPS_CREATOR=${ASCIIPS_CREATOR:-ASCIIPS} | |
ASCIIPS_FONT=${ASCIIPS_FONT:-Courier} | |
ASCIIPS_FONTSIZE=${ASCIIPS_FONTSIZE:-12} |
This file contains hidden or 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
/** | |
* ascii.h - Macros and constants for 7-bit ASCII | |
* Copyright (C) 2012 Matous J. Fialka, <http://mjf.cz/> | |
* Released under the terms of The MIT License | |
*/ | |
#ifndef ASCII_H | |
#define ASCII_H | |
#define is_7bit(x) ((x & 0x80) == 0) |
This file contains hidden or 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/awk -f | |
# PINGFMT - Format output of the ping(1) program | |
# Copyright (C) 2012 Matous J. Fialka, <http://mjf.cz/> | |
# Released under the terms of The MIT License | |
BEGIN { | |
# ----- HELP SCREEN ----- | |
help = help "Usage: pingfmt [-h|-help|-usage] [+[no][show]<opt>[=<val>]]\n" |
This file contains hidden or 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 | |
# IfChanged - returns 0 if file changed, 127 otherwise | |
# Copyright (C) 2013 Matous J. Fialka, <http://mjf.cz/> | |
# Released under the terms of The MIT License | |
fpath="$(realpath 2>/dev/null ""$1"")" || { | |
echo "Error: realpath $1 failed" 1>&2 | |
exit 1 | |
} |
This file contains hidden or 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 | |
# PREEN - Preen current/working directory by file type | |
# Copyright (C) 2013,2018,2020 Matous J. Fialka, <https://mjf.cz/> | |
# Released under the terms of The MIT License | |
PREENDIR="${PREENDIR:-.preen}" | |
PREENRC="${PREENRC:-.preenrc}" | |
for util in which find file test mkdir ln |
This file contains hidden or 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 | |
checksum=`echo $@ | sha1sum - | cut -d ' ' -f 1` | |
if ! [ -e /tmp/$checksum.ls-ZlaR ] | |
then | |
if ! ls -ZlaR $@ > /tmp/$checksum.ls-ZlaR | |
then | |
echo changed: could not create /tmp/$checksum.ls-ZlaR 1>&2 | |
exit 1 |
This file contains hidden or 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 | |
# ip6rev - Generate IPv6 PTR DNS RR | |
# Copyright (C) 2012 Matous J. Fialka, <http://mjf.cz/> | |
# Released under the terms of "The MIT License" | |
if [ $# -lt 1 -o -$# -gt 3 ]; then | |
cat <<- EOT | |
ip6rev ip6 rev [oct] | |
This file contains hidden or 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 | |
# Hint: paragraph and mac can be found in my gists as well. | |
# Cron: 30 4 * * * rm ~/.oui.txt && /usr/local/bin/vendor >/dev/null | |
if ! [ -f ~/.oui.txt ] | |
then | |
wget -qO ~/.oui.txt http://standards.ieee.org/develop/regauth/oui/oui.txt | |
fi |
This file contains hidden or 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/sed -f | |
# 10.0.0.0/8 | |
# 127.0.0.0/8 | |
/1\(0\|27\)\(\.\([0-9]\|[1-9][0-9]\|10[0-9]\|1[1-9][0-9]\|25[0-5]\|2[0-4][0-9]\)\)\{3\}/ p | |
# 172.16.0.0/19 | |
# 192.168.0.0/16 |