Skip to content

Instantly share code, notes, and snippets.

View hgwr's full-sized avatar
🏠
Working from home

Shigeru Hagiwara hgwr

🏠
Working from home
View GitHub Profile
@hgwr
hgwr / install-textlint.sh
Created August 17, 2019 14:47
install textlint full packages
npm install -g "textlint"
npm install -g "@textlint-ja/textlint-rule-no-insert-dropping-sa"
npm install -g "@textlint-rule/textlint-rule-no-invalid-control-character"
npm install -g "prh"
npm install -g "spellchecker"
npm install -g "textlint-rule-abbr-within-parentheses"
npm install -g "textlint-rule-common-misspellings"
npm install -g "textlint-rule-date-weekday-mismatch"
npm install -g "textlint-rule-en-capitalization"
npm install -g "textlint-rule-footnote-order"
#!/bin/bash
set -o errexit
set -o pipefail
set -o nounset
trap 'echo "Ctrl-C captured and exit."; exit 1' INT
find . -type d \( -not -path '.' -not -path '*outdir' \) -print0 | \
while read -d $'\0' line; do
#!/bin/bash
set -o errexit
set -o pipefail
set -o nounset
trap 'echo "Ctrl-C captured and exit."; exit 1' INT
trap 'echo "some error occured at $(pwd) and exit."; exit 8' SIGHUP
mkdir -p outdir || exit 1
#!/bin/bash
set -o errexit
set -o pipefail
set -o nounset
trap 'echo "Ctrl-C captured and exit."; exit 1' INT
outdir=$1
if [ "$outdir" == "" ]; then
@hgwr
hgwr / weekly_git_stats.rb
Last active July 28, 2019 12:26
weekly_git_stats.rb
#!/usr/bin/env ruby
#
# Usage:
# weekly_git_stats.rb
# weekly_git_stats.rb 2019-01-01 2019-07-31
#
# see also: cloc --vcs git
#
require 'date'
require 'open3'
@hgwr
hgwr / watch-file.sh
Created July 10, 2019 14:58
Watching files and directories bash script
#!/bin/bash -eu
#
# import from https://qiita.com/sonodar/items/ddeeb98525ef4c03d48e
#
# Requirement: yum install -y inotify-tools
#
# Usage: ./watch-file.sh /home/ads_hagiwara/tmp/tmp '^.*\.csv$' echo
#
trap "exit 0" 3 # QUITシグナルで停止