Skip to content

Instantly share code, notes, and snippets.

#!/bin/sh
USE_SED=
for arg in "$@" ; do
case $arg in
detail )
PICK_TAGS='<(title|updated|published|app:edited|app:draft|author)>|<(link|category|summary) '
;;
simple )
PICK_TAGS='<(title|published|app:draft|author)>|<(link|category) '
@hacolab
hacolab / hateblog-request
Last active August 2, 2019 11:57
hatenablog's AtomPub request command
#!/bin/sh
################################################################################
# This script is only send HTTP request to HatenaBlog's AtomPub API service,
# and output received HTTP response body to stdout.
# If GET request to entry collection page, auto try GET to next page.
#
#-[Usage]
#- $0 GET {Path} [-a Auth-File][-v][-n FD][-l Num[:Target]]
#- $0 DELETE {Path} [-a Auth-File][-v]
#- $0 PUT {Path} [-a Auth-File][-v][-f Tx-File]
#!/bin/sh
CMD_NAME=`basename $0`
usage_exit() {
cat <<- HELPEND
$CMD_NAME wait_time[hms] [-c command | message]
wait_time wait time[unit]
[unit]
h: hours = wait_seconds * 3600 [sec]
m: minutes = wait_seconds * 60 [sec]
s: seconds = wait_seconds [sec] (default)
@hacolab
hacolab / fpf
Last active July 22, 2019 15:01
#!/bin/sh
CMD_NAME=`basename $0`
VERSION=0.1.0
usage() {
cat <<- HELPEND
"pkg" wrapper command with fzf
USAGE:
$CMD_NAME [-l] [-niIRv] [package-name]
# USAGE: source "$0" on c-shell
set select_command=`history -r \
| fzf-tmux --no-sort --nth 3.. -d 90% \
| tr '\t' ' ' \
| sed -e 's/^[ ]*[0-9]*[ ]*[0-9:]*//'`
if ( "$select_command" == "" ) exit 0
eval $select_command
unset select_command
# USAGE: source "$0" on c-shell
if ( "$1" != "" ) then
if ( ! -d "$1" ) then
echo "'$1' is not directory!"
exit 1
endif
set root=$1
else
set root="."
endif
#!/bin/sh
query=$1
if [ $# -eq 2 ]; then
[ -d "$1" ] && cd "$1" \
|| ( echo "'$1' is not directory!" && exit 1 )
query=$2
fi
selected_files=`fzf --query="$query" --multi --select-1 --preview "head -n 100 {}"`
[ -n "$selected_files" ] && nvim `echo "$selected_files" | tr '\n' ' '`
##################################################
# Basic config
##################################################
# use shell (don't load .login file)
set -g default-command /bin/tcsh
# buffer line size
set -g history-limit 10000
# start index
#!/bin/sh
CMD_NAME=`basename $0`
TEMP_FILE="$HOME/.cache/$CMD_NAME.$$.html"
# help
Usage(){
cat <<- HELPEND
$CMD_NAME [-b][-f][-u] PageName
Open manual page.
-b Base Definitions (XBD) ... C header files.
#!/bin/sh
CMD_NAME=`basename "$0"`
TMP_FILE="/tmp/${CMD_NAME}.$$.html"
Usage(){
cat <<- HELPEND
$CMD_NAME [-v version] [section-number] page-name
-v target freebsd version
HELPEND
}