Skip to content

Instantly share code, notes, and snippets.

View franzramadhan's full-sized avatar
🔥
Working from home

Frans Caisar Ramadhan franzramadhan

🔥
Working from home
View GitHub Profile
@franzramadhan
franzramadhan / Run Docker HAProxy
Last active February 12, 2018 06:29
Docker HAProxy
docker run -d --network=host --restart=always -p 8080:8080 -v /data/haproxy:/usr/local/etc/haproxy:ro --name haproxy haproxy
openssl req -newkey rsa:2048 -nodes -keyout vm1.key -x509 -days 365 -out vm1.crt
The :g// command is what you're looking for — it runs a command on each line matching a pattern:
:g/Thing to find/ s/$/ Stuff to append/
@franzramadhan
franzramadhan / 99-vrrp.conf
Last active October 19, 2017 03:05
Maxcale and Keepalived Configuration
# /etc/sysctl.d/99-vrrp.conf
net.ipv4.ip_nonlocal_bind = 1
@franzramadhan
franzramadhan / haproxy.cfg
Created October 4, 2017 06:14
HAProxy and Keepalived Configuration for resilient infrastructure
global
log 127.0.0.1 local2 info
chroot /var/lib/haproxy
pidfile /var/run/haproxy.pid
maxconn 1024
user haproxy
group haproxy
daemon
defaults
@franzramadhan
franzramadhan / scaling performance
Created September 5, 2017 09:56
change cpu freq governor
echo performance | tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor >/dev/null
@franzramadhan
franzramadhan / ntp.conf
Created August 25, 2017 15:39
enable pid for services in Centos 7
#/etc/ntp.conf
pidfile /var/run/ntp/ntp.pid
@franzramadhan
franzramadhan / console-shutdown.exp
Created July 18, 2017 14:58
Custom Java Application Init Scripts
#!/usr/bin/expect
#
# Shutdown Queue jpr@2013
#
################################################################3
set timeout 20
set host [lindex $argv 0]
set port [lindex $argv 1]
@franzramadhan
franzramadhan / ulimit
Last active July 31, 2017 04:41
modify ulimit centos regular user
sudo sh -c "ulimit -u 65535 && exec su $LOGNAME"
if failed
#open files ( -n)
firstwap soft nofile 8192
firstwap hard nofile 8192
#max user processes (-u)
firstwap hard nproc 65535
firstwap soft nproc 65535
@franzramadhan
franzramadhan / rsync
Last active July 18, 2017 06:51
rsync files with time attribute
find . -newermt "2017-07-16" -print0 | xargs -0 -I% rsync -avpP % root@lilinta:/var/lib/vz/ksa