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 | |
show_usage() { | |
echo "Usage: $this_command [YEAR MONTH]" 1>&2 | |
echo "Example: $this_command 2012 03 <- 2012 March" 1>&2 | |
echo " $this_command <- Next month" 1>&2 | |
} | |
# 引数解析 | |
this_command=$(basename $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
#!/bin/sh | |
show_usage() { | |
echo "Usage: $this_command PREFIX NUM_OF_PAGES" 1>&2 | |
} | |
this_command=$(basename $0) | |
prefix=$1 | |
num_of_pages=$2 |
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 bash | |
source_user_defined() { | |
readonly catalogue=( | |
'date +%Y/%m/%d' | |
'date +"%Y/%m/%d %T"' | |
'date +"%Y/%-m/%-d(%a)"' | |
'LANG=C date +"%Y/%-m/%-d(%a)"' | |
'echo 平成$(($(date +%y) + 12))年' | |
'date --iso-8601' |
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 bash | |
__die() { printf "%s\n" "$@" 1>&2; exit 1; } | |
__tomato_timer() { | |
local timer_minutes | |
local notification_bg | |
timer_minutes=$1; shift | |
notification_bg=$1; shift |
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 bash | |
as_binary() { | |
[[ $1 =~ ^([0#]?b)?([0-1]+)$ ]] || return | |
local bin=${BASH_REMATCH[2]} | |
local dec=$(bc -l <<< "ibase=2; $bin") | |
printf '[\033[34m#b%d\033[m #o%o %d #x%X]\n' $bin $dec $dec $dec | |
} | |
as_octal() { |
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 bash | |
termcolor() { | |
local words="$*" | |
local esc="$(printf '\e')" | |
readonly intensity=( "" "1" ) | |
readonly underline=( "" "4" ) | |
readonly fg16=( "" "30" "31" "32" "33" "34" "35" "36" "37" ) | |
local bg16=( "" "40" "41" "42" "44" "44" "45" "46" "47" ) | |
local sgr |
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 bash | |
die() { | |
local message="$1" | |
printf "%s\n" "$message" >&2 | |
exit 1 | |
} | |
check_deps() { | |
hash jq 2>/dev/null || die "command not found: jq" |
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 bash | |
wn_wrapper() { | |
local keyword="$1" | |
keyword=$(sed 's/ /_/g' <<< "$keyword") | |
local editor | |
if hash gsed 2>/dev/null; then | |
editor=gsed | |
else |
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 bash | |
die() { | |
IFS=' ' printf "%s\n" "$*" 1>&2 | |
exit 1 | |
} | |
unshorten() { | |
curl --silent --output /dev/null --head --write-out "%{url_effective}\n" --location "$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
#!/bin/bash | |
main() { | |
local -r now=$(date +%s) | |
find /usr/share/zoneinfo -type d -name right -prune \ | |
-o -type d -name posix -prune \ | |
-o -type f -print | while read -r f; do | |
if [[ $(head -c 4 "$f") != TZif ]]; then | |
continue | |
fi |
OlderNewer