Skip to content

Instantly share code, notes, and snippets.

@holly
holly / lambda_console_login.py
Last active August 14, 2022 11:02
aws console login notification script
#!/usr/bin/env python
# vim:fileencoding=utf-8
""" [NAME] script or package easy description
[DESCRIPTION] script or package description
"""
import os, sys, io
import json
from pyline_notify import PyLINENotify
#!/bin/bash
set -e
set -o pipefail
GO_VERSION=1.17.7
GO_PATH=/usr/local/bin/go
GOFMT_PATH=/usr/local/bin/gofmt
MODE=$1
@holly
holly / github-pandoc.css
Created March 1, 2022 14:09 — forked from dashed/github-pandoc.css
GitHub-like CSS for pandoc standalone HTML files (perfect for HTML5 output). Based on Marked.app's GitHub CSS. Added normalize.css (v2.1.3) in the prior to GitHub css.
/*! normalize.css v2.1.3 | MIT License | git.io/normalize */
/* ==========================================================================
HTML5 display definitions
========================================================================== */
/**
* Correct `block` display not defined in IE 8/9.
*/
#!/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 curve25519-sha256@libssh.org,ecdh-sha2-nistp521,ecdh-sha2-nistp384,ecdh-sha2-nistp256,diffie-hellman-group-exchange-sha256
Ciphers chacha20-poly1305@openssh.com,aes256-gcm@openssh.com,aes128-gcm@openssh.com,aes256-ctr,aes192-ctr,aes128-ctr