Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
set -eu
ROTATE=7
BACKUP_DIR=/backup/mysql
XTRABACKUP=/usr/bin/xtrabackup
MYSQL_CNF=/root/.my.cnf
CPU_COUNT=$(grep -c processor /proc/cpuinfo)
MYSQL_ROOT_PASSWORD=$(grep -m1 password $MYSQL_CNF | sed -e 's/password="\(.*\)"/\1/')
@holly
holly / mysql_secure_install.sh
Created August 1, 2021 07:16
oneliner mysql_secure_install
#!/bin/bash
set -e
if [ $# != 1 ]; then
echo "Usage: mysql_secure_install.sh \$password"
exit 1
fi
MYSQL_CMD="/usr/bin/mysql -B"
@holly
holly / initializer.yml
Last active July 22, 2021 14:40
ansible-bestpractice-directory yml
# localhost上で、AnsibleのBestpracticeなディレクトリ構成の雛形を作成します。
#
# 以下のように、localhost指定で作成します・
# ansible-playbook -i localhost, -c local initializer.yml
- hosts: localhost
vars_prompt:
- name: "root_dir_name"
prompt: "生成するディレクトリ名を指定してください。"
confirm: no
#!/usr/bin/env perl
use strict;
use warnings;
use utf8;
use autodie;
use feature qw(say);
use File::Spec;
use FindBin qw($Script $Bin);
use LINE::Notify::Simple;
@holly
holly / worker_cpu_affinity.sh
Last active January 30, 2021 15:50
nginx worker_cpu_affinity generator (inspire from https://github.com/cubicdaiya/nwcagen/blob/master/nwcagen.go)
#!/bin/bash
cpu_num=$(nproc)
array=()
echo -n "worker_cpu_affinity "
if [ $cpu_num = 1 ]; then
echo "auto;"
exit
fi
@holly
holly / md_sync_call.sh
Created January 17, 2021 15:11 — forked from tagomoris/md_sync_call.sh
Run "check" about specified md device if it's status is "idle"
#!/bin/sh
TARGET_MD=$1
### call md verifying when idle.
######
# HOW TO USE
### md_sync_call.sh md0
error_exit() {
@holly
holly / sshd_config
Last active January 17, 2021 08:12
sshd_config sample
Port 9022
#AddressFamily any
#ListenAddress 0.0.0.0
#ListenAddress ::
#HostKey /etc/ssh/ssh_host_rsa_key
#HostKey /etc/ssh/ssh_host_ecdsa_key
#HostKey /etc/ssh/ssh_host_ed25519_key
KexAlgorithms [email protected],ecdh-sha2-nistp521,ecdh-sha2-nistp384,ecdh-sha2-nistp256,diffie-hellman-group-exchange-sha256
Ciphers [email protected],[email protected],[email protected],aes256-ctr,aes192-ctr,aes128-ctr
@holly
holly / VBAAccelator.cls
Created December 20, 2020 02:13
VBA Acclelation Class
VERSION 1.0 CLASS
BEGIN
MultiUse = -1 'True
END
Attribute VB_Name = "VBAAccelator"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
Option Explicit
@holly
holly / mariadb-server-mem2G.cnf
Last active December 19, 2020 15:16
mariadb-server-mem2G.cnf
# this is read by the standalone daemon and embedded servers
[server]
# this is only for the mysqld standalone daemon
[mysqld]
port = 3306
socket = /run/mysqld/mysqld.sock
datadir = /var/lib/mysql
server-id=1
@holly
holly / ModuleUtility.bas
Last active January 5, 2021 02:56
ModuleUtility
Attribute VB_Name = "ModuleUtility"
Option Explicit
'=== 参照設定で有効にしておく項目 ===
'Microsoft Scripting Runtime
' FileSystemObject
'
'ストリーミング関係(UTF-8なcsvを出力や読み込みなど)
'Microsoft ActiveX Data Objects x.x Library
' ADODB.stream