Skip to content

Instantly share code, notes, and snippets.

@iinm
iinm / fix-chrome-scaling-factor.sh
Last active July 2, 2023 08:01
Fix Chrome scaling factor on Ubuntu
cat /usr/share/applications/google-chrome.desktop \
| sed -E 's,^(Exec=[^ ]+)(.*),\1 --force-device-scale-factor=1.15\2,g' \
> ~/.local/share/applications/google-chrome.desktop
@iinm
iinm / countries.py
Created June 13, 2021 08:21
List countries
#!/usr/bin/env python
# coding: utf-8
# Usage:
# python countries.py | jq -R 'split("\t") | {code: .[4], name: .[0], nameEn: .[1], location: .[5]}' | jq -s .
import sys
import urllib.request
import lxml
import lxml.html
@iinm
iinm / ansible_module_template.bash
Created May 14, 2021 23:34
Ansible module template in Bash
#!/usr/bin/env bash
# cp <module_name>.sh ./library/
# ansible localhost -M ./library/ -m <module_name> -a 'arg1=foo' --check -vvv
set -eu -o pipefail
# Arguments are passed as a file
arg_file="$(dirname "${BASH_SOURCE[0]}")/args"
@iinm
iinm / README.md
Last active February 12, 2021 12:55
Jenkins quick start
pacman --sync PACKAGE_NAME # install package
pacman --sync --refresh --sysupgrade # upgrade all package
pacman --remove --recursive PACKAGE_NAME # remove package
cat 'IgnorePkg = PACKAGE_NAME' >> /etc/pacman.conf # ignore upgrade
asp checkout PACKAGE_NAME # get package source
makepkg --syncdeps --skippgpcheck # build package, require base-devel package group
# remove unneeded packages
#!/usr/bin/env bash
set -eu -o pipefail
# given:
input=$(cat << JSON
{
"a": 1,
"b": { "c": 2 },
"d": { "e": [3, 4] }

JenkinsのジョブをGit管理して設定更新を自動化する

Recruit Engineers Advent Calendar 2019 の3日目(12/3)のエントリーです。

背景

アプリケーションのテスト、ビルドなどを始め様々な用途で使われるJenkinsですが、私は以下のような運用作業の自動化に利用しています。

  • Ansible Playbookの実行
# show sentinel status
redis-cli -p $sentinel_port info sentinel
#!/usr/bin/env bash
set -eu
on_exit() {
exit_status="$?"
echo "--- on_exit: exit_status=$exit_status"
return "$exit_status"
}
# ボリュームから複数ファイルを取り出す
docker run --rm -v data:/data busybox tar -C /data -cf - hoge huga | tar -xf -