Skip to content

Instantly share code, notes, and snippets.

View rizkyabdilah's full-sized avatar

Rizky Abdilah rizkyabdilah

View GitHub Profile
@rizkyabdilah
rizkyabdilah / .vimrc
Created August 13, 2018 08:35
VIM Configuration
syntax on
set tabstop=4
set shiftwidth=4
set expandtab
@rizkyabdilah
rizkyabdilah / mvkey.lua
Created April 14, 2015 06:08
redis move keys
local kys = redis.call('KEYS', '*')
for _, key in ipairs(kys) do
redis.call('MIGRATE', 'dst_host', 'dst_port', key, 'dst_db', 1000, 'replace')
end
return 1
// one line eval
eval "local kys = redis.call('KEYS', '*') for _, key in ipairs(kys) do redis.call('MIGRATE', 'dst_host', 'dst_port', key, 'dst_db', 1000, 'replace') end; return 1" 0
@rizkyabdilah
rizkyabdilah / gist:8516303
Created January 20, 2014 07:25
daemontools install error: /lib64/libc.so.6: could not read symbols: Bad value
vim src/errno.h
ganti:
-extern int errno;
+#include <errno.h>
@rizkyabdilah
rizkyabdilah / unpick1.php
Last active December 20, 2015 05:19
Beautiful Code, blog post on my blog http://rizky.abdi.la
function unpickSeatById($seating_id){
$book_key = "booking-seat-" . strval($seating_id);
$this->redis->del($book_key);
return changeSeatStatusById($seating_id, 1);
}
@rizkyabdilah
rizkyabdilah / config.txt
Created July 27, 2012 17:39
Use backup server on HAProxy when connection is too much or one service is going down
frontend frontend_service 127.0.0.1:9200
mode tcp
balance roundrobin
acl max_conn_reached fe_conn gt 20
acl production_almost_death nbsrv(production) lt 2
default_backend production
use_backend production_and_backup if max_conn_reached OR production_almost_death
backend production
mode tcp
@rizkyabdilah
rizkyabdilah / 1.sh
Created July 1, 2012 18:42
Install fastcgiwrap and spawn-fcgi on CentOS 5
## maybe you cannot find fcgi-devel package
wget http://www.fastcgi.com/dist/fcgi.tar.gz
tar -xzf fcgi.tar.gz
cd fcgi
./configure
make
make install
## install fcgiwrap
@rizkyabdilah
rizkyabdilah / euler_67.py
Created June 16, 2012 21:56
Project Euler Problem #67
#!/opt/python/bin/python
# @author: Rizky Abdilah
# @description: Project Euler Problem #67
if __name__ == "__main__":
nlist, lnumber = [], 0
fp = open("/tmp/euler/67.txt", "r")
for line in fp:
lnumber += 1
@rizkyabdilah
rizkyabdilah / remove.py
Created June 15, 2012 16:43
get email address at test.easy
#!/opt/python/bin/python
import re
if __name__ == "__main__":
_remove_re = re.compile(r"(%|\^|\*|\(|\)|\{|\}|\[|\]|\$|@|!|_|\ |&|#|\+)")
fp = open("/tmp/test.easy", "r")
buff = fp.read()
fp.close()
@rizkyabdilah
rizkyabdilah / example.py
Created June 15, 2012 03:28
Handle/kill child process when parent process dies
from multiprocessing import Process
import os
import sys
from time import sleep
class JobSeeker(object):
def __init__(self, ppid=None):
self.ppid = ppid