Skip to content

Instantly share code, notes, and snippets.

Shigeru Hagiwara hgwr

Block or report user

Report or block hgwr

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@hgwr
hgwr / rspec.sh
Created Aug 23, 2019
run rspec and show results and coverages
View rspec.sh
#!/bin/bash
export CIRCLE_ARTIFACTS=.
export COVERAGE=true
export CI=true
export DISABLE_SPRING=true
export ENABLE_COV=true
export RAILS_ENV=test
logifle=~/tmp/rspec_`date +'%Y%m%d-%H%M%S'`.log
bundle exec rspec 2>&1 | tee $logifle
@hgwr
hgwr / install-textlint.sh
Created Aug 17, 2019
install textlint full packages
View install-textlint.sh
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"
@hgwr
hgwr / ng_test.sh
Last active Aug 23, 2019
run ng test and less log file
View ng_test.sh
#!/bin/bash
logifle=~/tmp/ng_test_`date +'%Y%m%d-%H%M%S'`.log
if [ `node -v` == "v8.9.4" ]; then
ng test --single-run --code-coverage 2>&1 | tee "$logifle"
else
ng test --watch=false --code-coverage 2>&1 | tee "$logifle"
fi
open coverage/index.html
@hgwr
hgwr / .textlintrc
Last active Aug 18, 2019
.textlintrc
View .textlintrc
{
"filters": {},
"rules": {
"@textlint-ja/no-insert-dropping-sa": true,
"ja-hiragana-fukushi": true,
"ja-hiragana-hojodoushi": false,
"ja-hiragana-keishikimeishi": true,
"max-appearence-count-of-words": true,
"no-surrogate-pair": true,
"prefer-tari-tari": true,
@hgwr
hgwr / .aspell.conf
Last active Aug 17, 2019
2019-08-12 hgwr's home settings
View recursive_lightweighter.sh
#!/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
View lightweighter.sh
#!/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
View whitening.sh
#!/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 Jul 28, 2019
weekly_git_stats.rb
View 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 Jul 10, 2019
Watching files and directories bash script
View watch-file.sh
#!/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シグナルで停止
You can’t perform that action at this time.