Skip to content

Instantly share code, notes, and snippets.

View mjf's full-sized avatar

Matouš Jan Fialka mjf

View GitHub Profile
@mjf
mjf / cycled.sh
Created April 26, 2012 12:15
Script to tell whether any of it's argument repeats
#! /bin/sh
# If no arguments are given, return true.
if [ $# -eq 0 ]
then
exit 0
fi
# Test whether any of the arguments repeats.
@mjf
mjf / pinyin2utf8.sed
Created May 13, 2012 23:41
pinyin2utf8.sed -- Convert US-ASCII Pinyin to UTF-8
#! /bin/sed -f
# pinyin2utf8.sed -- Convert US-ASCII Pinyin to UTF-8
# Copyright (C) 2012 Matous J. Fialka (mjf), <http://mjf.cz/>
# Released under the terms of The MIT License
#
# DESCRIPTION
# Script converts all occurences of US-ASCII encoded Pinyin text
# enclosed by the solidus characters pairs to UTF-8 encoded text.
#
@mjf
mjf / par2ln.sed
Created June 6, 2012 00:17
par2ln.sed - join paragraphs lines with inverse indentation
#! /bin/sed -f
# par2ln.sed - join paragraphs lines with inverse indentation
# Copyright (C) 2012 Matous J. Fialka, <http://mjf.cz/>
# Released under the terms of The MIT License
# Input:
#
# foo
# bar
@mjf
mjf / wom.sh
Created July 8, 2012 15:05
WOM -- ISO8601 and ICU compliant week of a month
#! /bin/sh
# WOM -- ISO8601 and ICU compliant week of a month
# Copyright (C) 2012 Matous J. Fialka, <http://mjf.cz/>
# Released under the terms of The MIT License
if [ $# -ne 1 ] || [ "$1" != +%w -a "$1" != +%u ]
then
cat 1>&2 <<- EOT
Usage: wom +%[wu];
@mjf
mjf / terminal.rem
Created July 18, 2012 00:15
ANSI/XTerm control sequences for remind(1)
; ANSI/XTerm control sequences for remind(1)
; Copyright (C) 2012 Matous J. Fialka, <http://mjf.cz/>
; Released under the terms of The MIT License
set bel char(7)
set esc char(27)
set csi esc + "["
; ANSI attributes
@mjf
mjf / sipcalc-add-ipv4-default-route.awk
Created August 3, 2012 07:54
Add IPv4 default route to the output of sipcalc(1)
#! /usr/bin/awk -f
# Add IPv4 default route to the output of sipcalc(1)
# Copyright (C) 2009 Matous Jan Fialka, <http://mjf.cz/>
# Released under the terms of The MIT License
#
# Parse output of sipcalc(1) and add default route value
# to the output stream if prefix length is less or equal to 30.
# If prefix length equals to 30 then the lower usable address
# is added as default route, the highest usable address is
@mjf
mjf / sipcalc-add-ipv6-default-route.awk
Created August 3, 2012 08:02
Add IPv6 default route to the output of sipcalc(1)
#! /usr/bin/awk -f
# Add IPv6 default route to the output of sipcalc(1)
# Copyright (C) 2009 Matous Jan Fialka, <http://mjf.cz/>
# Released under the terms of The MIT License
#
# Assumes last usable IPv6 address as default route.
#
# Usage: sipcalc <net>[/<mask>] | sipcalc-add-ipv6-default-route.awk
@mjf
mjf / sipcalc-translate-to-czech.sed
Created August 3, 2012 08:27
Translate output of sipcalc(1) to Czech language
#! /bin/sed -f
# Translate output of sipcalc(1) to Czech language
# Copyright (C) 2009 Matous Jan Fialka, <http://mjf.cz/>
# Released under the terms of The MIT License
#
# Usage: sipcalc <net>[/<mask>] | sipcalc-translate-to-czech.sed
# Both IPv4 and IPv6 output of sipcalc(1)
@mjf
mjf / look.lua
Created August 28, 2012 22:50
look.lua - Ion3 or Ion3plus look called "Shiny"
--------------------------------------------------------------------------------
-- look.lua - Ion3 or Ion3plus look called "Shiny"
-- Copyright (C) 2008,2009 Matous J. Fialka, <http://mjf.cz/>
-- Relesed under the terms of The MIT License
--
-- Remarks: Drop into ~/.ion3/ or install in the system-wide directory
-- Authors: Matous Jan Fialka
-- Created: Tue Apr 1 00:12:52 CEST 2008
-- Updated: Mon Feb 9 01:09:41 CET 2009
--------------------------------------------------------------------------------
@mjf
mjf / man2pdf.sh
Created September 4, 2012 12:53
man2pdf -- Convert manual page to PDF via PS
#! /bin/sh
# man2pdf -- Convert manual page to PDF via PS
# Copyright (C) 2012 Matous J. Fialka, <http://mjf.cz/>
# Released under the terms of The MIT License
groff='groff -Tps -mandoc'
ps2pdf='ps2pdf -'
file=file
man='man -w'