Skip to content

Instantly share code, notes, and snippets.

View orrisroot's full-sized avatar
🥰
Wish for your happiness

Yoshihiro OKUMURA orrisroot

🥰
Wish for your happiness
  • RIKEN
View GitHub Profile
@orrisroot
orrisroot / update-docker-composed-service.sh
Created November 15, 2021 09:40
Script to update docker images and to restart docker composed services, if used docker images has been updated.
#!/bin/bash
for cmd in docker jq; do
if ! command -v ${cmd} > /dev/null; then
echo "Error: ${cmd} is required." 1>&2
exit 1
fi
done
COMPOSE_FILE="$1"
@orrisroot
orrisroot / setup-docker-compose.sh
Created November 15, 2021 04:49
Setup docker compose plugin
#!/bin/bash
for cmd in docker curl jq; do
if ! command -v ${cmd} > /dev/null; then
echo "Error: ${cmd} is required to setup docker compose plugin." 1>&2
exit 1
fi
done
DOCKER_COMPOSE="${HOME}/.docker/cli-plugins/docker-compose"
@orrisroot
orrisroot / detect-updates-to-the-docker-base-image.sh
Last active May 16, 2023 00:48
Detect updates to the Docker base image
#!/bin/bash
REQUIRED_COMMANDS=("skopeo" "jq" "basename")
for COMMAND in "${REQUIRED_COMMANDS}"; do
if ! command -v ${COMMAND} > /dev/null; then
echo "Error: ${COMMAND} command is required." 1>&2
exit 2
fi
done
@orrisroot
orrisroot / rpmcheck.sh
Last active December 3, 2021 08:33
configuration check script after update rpm packages
#!/bin/bash
# VERSION:20211203
_uid=$(id -u)
if test $_uid -ne 0; then
echo "Error : This script have to run as root"
exit 1
fi
@orrisroot
orrisroot / .php-cs-fixer.php
Last active July 27, 2022 03:30
default php-cs-fixer configuration for my projects
<?php
declare(strict_types=1);
$config = new PhpCsFixer\Config();
return $config
->setRiskyAllowed(true)
->setRules([
'@Symfony' => true,
@orrisroot
orrisroot / get-ipv6-global-addr.sh
Created April 26, 2020 02:00
Get IPv6 global address
#!/bin/bash
DEVICE=$1
ip addr show dev ${DEVICE} | sed -e 's/^.*inet6 \([^ ]*\)\/.*scope global.*$/\1/;t;d'
@orrisroot
orrisroot / deploy-hook.sh
Last active October 20, 2021 08:23
Service restart script for Let's encrypt renewal hooks (deploy)
#!/bin/bash
SERVICE_NAME=postfix
SERVICE_DOMAINS=example.com
IS_ACTIVE=$(systemctl is-active ${SERVICE_NAME})
if [ "${IS_ACTIVE}" != "active" ]; then
exit 0
fi
@orrisroot
orrisroot / .zshrc
Created February 21, 2020 15:37
zshrc on macOS catalina
bindkey '^P' history-search-backward
bindkey '^N' history-search-forward
@orrisroot
orrisroot / backup.sh
Last active November 13, 2023 00:49
cron daily backup script
#!/bin/bash
export LANG=C
BACKUPDIR=/backup/daily
DATE=`date`
if test ! -d $BACKUPDIR; then
mkdir -p $BACKUPDIR
chmod 700 $BACKUPDIR
@orrisroot
orrisroot / replace_owner.py
Last active April 2, 2018 11:53
mailman withlist script to replace list owner address
#!/usr/bin/python
"""Replace list's owner address.
This script is intended to be run as a bin/withlist script, i.e.
% bin/withlist -l -r replace_owner listname from_address to_address
If run standalone, it prints this help text and exits.
"""