Must-have tools for nomlab members; mainly small CLI scripts. It includes very site-specific scripts, but some script might be useful for other audiences.
- ame
- Set Slack status or send message with CLI
- favico
- Create simple one-letter icon for placeholder.
- gem-new
- Create a new Gem project in sandbox using bundler.
- matplot
- Invoke python3 with matplotlib using Docker
- nginx-docker
- Pull Nginx official docker image and run instantly.
- prodargs
- Execute a command multiple times changing the convination of option args.
- rails-new
- Create a new Rails project with some useful gems.
- slack-sweeper
- Bulk remove all Slack files older than N days.
- treetable
- Convert markdown or org-mode style section tree into table. It is supposed to be used for conversion of issue list into table.
Set Slack status or send message with CLI.
ame [-c CONFIG_FILE] [-t TOKEN_NAME] -m message CHANNEL TEXT [TITLE] [LINK] ame [-c CONFIG_FILE] [-t TOKEN_NAME] -m status ICON TEXT -c Set config file (default: ~/.config/ame/config.sh). -t Select token name found in config.sh. -m Select method (message or status). examples: ame -m message general "Hi" ame -m message general "Hi" "Title" "http://www.quickhack.net" ame -m status :office: "I am at office"
See also about config example examples/ame/config.sh
Create simple one-letter icon for placeholder.
favico [-s size] [-c color] [-b bgcolor] [-f font] -o FILENAME STRING
examples: favico -s 64 -c white -b blue -o N.png 'N' favico -s 64 -f '/Library/Fonts/ヒラギノ丸ゴ ProN W4.ttc' -o nom.png '乃'
To list-up available fonts, try:
convert -list font | grep Font:
Create a new Gem project in sandbox using bundler.
gem-new project-name
It does:
- Create
./project-name
directory - Invoke
bundle gem project-name
with recommended options. - Invoke
bundle config set path vendor/bundle
- Add .gitignore from
github/gitignore
Invoke python3 with matplotlib using Docker
Pull Nginx official docker image and run instantly.
You can serve your own HTML files in ~/Downloads/www/
nginx-docker {start|stop}
It does:
- Create minimum config file as
$HOME/Downloads/nginx/nginx.conf
- Create minimum index.html as
$HOME/Downloads/www/index.html
- pull official Nginx docker image and invoke:
docker run -d -p 8080:8080 --name nginx \ -v "$HOME/Downloads/nginx":/etc/nginx/conf.d/ \ -v "$HOME/Downloads/www":/var/www \ nginx
- open http://localhost:8080
Execute a command multiple times changing the convination of option args. For example, if you want to perform some benchmark changing its parameters, You need to type boring commands:
some_benchmark -t 1 -r 1 -s 1 some_benchmark -t 1 -r 1 -s 10 some_benchmark -t 1 -r 2 -s 1 some_benchmark -t 1 -r 2 -s 10 some_benchmark -t 2 -r 1 -s 1 some_benchmark -t 2 -r 1 -s 10 some_benchmark -t 2 -r 2 -s 1 some_benchmark -t 2 -r 2 -s 10
By using prodarg, it becomes:
prodargs -- some_benchmark -t 1-2 -r 1-2 -s 1,10
With -n option, it perform dry-run; shows what happens.
prodargs -n -- some_benchmark -t 1-2 -r 1-2 -s 1,10
You can embed optargs in other args:
prodargs -- some_benchmark -l log-t%t-r%r-s%s.log -t 1-2 -r 1-2 -s 1,5
Does:
some_benchmark -l log-t1-r1-s1.log -t 1 -r 1 -s 1 some_benchmark -l log-t1-r1-s5.log -t 1 -r 1 -s 5 some_benchmark -l log-t1-r2-s1.log -t 1 -r 2 -s 1 some_benchmark -l log-t1-r2-s5.log -t 1 -r 2 -s 5 some_benchmark -l log-t2-r1-s1.log -t 2 -r 1 -s 1 some_benchmark -l log-t2-r1-s5.log -t 2 -r 1 -s 5 some_benchmark -l log-t2-r2-s1.log -t 2 -r 2 -s 1 some_benchmark -l log-t2-r2-s5.log -t 2 -r 2 -s 5
Create a new Rails project in sandbox using bundler. It requires npm and yarn. Rails 7 does not need npm, yarn. However, bootstrap needs.
rails-new project-name
It does:
- Create
./project-name
directory - Create temporal Gemfile for bootstrap
- Install Rails with bundler
- Invoke
bundle exec rails new
overriding initial Gemfile with some additionals:- bootstrap
- bootstrap_form
- kaminari
- ransack
- Add .gitignore from
github/gitignore
- Set timezone to Tokyo (JST)
- Install ja locale files
- Set default locale to ja
- Install config/locales/ja.ym
- Install config/locales/activerecord.ja.yml
Bulk remove all Slack files older than N(>30) days.
Usage: slack-sweeper [-n] SLACK_API_TOKEN DAYS -n: dry run.
For safety, this script does not remove more than 300 files.
Usage: treetable sample-todo-list.{md|org} > sample-todo-list.tex
For details about input-file format, check examples/treetable/todo-list.org or examples/treetable/todo-list.md. See also about output example examples/treetable/todo-list.pdf