Skip to content

Instantly share code, notes, and snippets.

View hacker65536's full-sized avatar
:octocat:
learning

hacker65536 hacker65536

:octocat:
learning
View GitHub Profile
version: '2'
services:
db:
image: mysql:5.7
volumes:
- db_data:/var/lib/mysql
restart: always
environment:
MYSQL_ROOT_PASSWORD: wordpress
sudo yum update -y && sudo reboot
sudo yum install -y --enablerepo=epel bash-completion
sudo yum install -y git jq
@hacker65536
hacker65536 / trap_spin.sh
Created October 24, 2016 06:14
trap spinner
#!/bin/bash
tmpdir=$(mktemp -d -p "./")
tmpf=$(mktemp -u)
mkfifo $tmpf
@hacker65536
hacker65536 / trap_test.sh
Created October 24, 2016 06:13
trap test
#!/bin/bash
set -me
function exitf(){
echo "catch exit"
}
function excep(){
echo "catch exception"
}
@hacker65536
hacker65536 / ext.sh
Created October 24, 2016 06:10
extglobsample
#!/bin/bash
shopt -s extglob
string='@(foo|bar)'
read choice
case $choice in
$string ) printf 'String choice %-20s' "$choice"; ;;
$s1|$s2 ) printf 'Two val choice %-20s' "$choice"; ;;
*) printf 'A Bad choice! %-20s' "$choice"; ;;
#cloud-config
repo_update: true
repo_upgrade: all
timezone: "Asia/Tokyo"
power_state:
mode: reboot
yum -y update
yum install -y openldap-servers openldap-clients
yum install -y --enablerepo=epel ldapvi
echo -e '#ldaplog\nlocal4.*\t-/var/log/ldaplog' > /etc/rsyslog.d/ldap.conf
sed -i '3s/\(.*\)/\1\n\/var\/log\/ldaplog/' /etc/logrotate.d/syslog
service rsyslog restart
cp /usr/share/openldap-servers/DB_CONFIG.example /var/lib/ldap/DB_CONFIG
yum -y update
yum install -y openldap-servers openldap-clients
yum install -y --enablerepo=epel ldapvi
echo -e '#ldaplog\nlocal4.*\t-/var/log/ldaplog' > /etc/rsyslog.d/ldap.conf
sed -i '3s/\(.*\)/\1\n\/var\/log\/ldaplog/' /etc/logrotate.d/syslog
service rsyslog restart
cp /usr/share/openldap-servers/DB_CONFIG.example /var/lib/ldap/DB_CONFIG
yum install -y git
cd
curl -s https://raw.githubusercontent.com/Shougo/dein.vim/master/bin/installer.sh > installer.sh
sh ./installer.sh ~/.vim
cat <<'EOF' > ~/.vimrc
set noexpandtab
set autoindent
set smartindent
#!/bin/bash
set -eu
atexit() {
[[ -n $tmpfile ]] && rm -f "$tmpfile"
}
tmpfile=$(mktemp "/tmp/${0##*/}.tmp.XXXXXX")
trap atexit EXIT
trap 'atexit; exit -1' SIGHUP SIGINT SIGTERM