Skip to content

Instantly share code, notes, and snippets.

@kenshinx
kenshinx / celeryconfig.py
Created June 6, 2013 04:32
Celery config file in our project. Hope can be reference to some other guys
import os
import sys
from kombu import Exchange, Queue
from datetime import timedelta
from config import cfg
import log
@kenshinx
kenshinx / client.go
Last active February 3, 2024 18:49
golang socket server & client ping-pong demo
package main
import (
"os"
"log"
"net"
"strconv"
"strings"
)
import threading
import requests
#Reference for weirong.
Max_concurrency = 50
def request(url):
@kenshinx
kenshinx / rsync.conf
Created July 31, 2013 04:25
rsync 配置文件
pid file = /var/run/rsyncd.pid
port = 873
address = 0.0.0.0
uid = root
gid = root
use chroot = no
@kenshinx
kenshinx / supervisrord.conf
Created August 21, 2013 03:47
supervisord.conf with godns and joke
[unix_http_server]
file=/tmp/supervisor.sock ; path to your socket file
chmod=0777
chown=supervisord:supervisord
[inet_http_server]
port=1222
username=sinasec
password=hello
@kenshinx
kenshinx / config
Last active December 25, 2015 18:39
Nginx C Module.
addon_name=ngx_http_echo_module
HTTP_MODULES="$HTTP_MODULES ngx_http_echo_module"
NGX_ADDON_SRCS="$NGX_ADDON_SRCS $ngx_addon_dir/ngx_http_echo_module.c"
@kenshinx
kenshinx / timer.lua
Created December 4, 2013 04:00
lua timer. based on luajit ffi load signal
--Lua timer library based on C signal.
--Notice: signal need Posfix system support
local ffi = require "ffi"
ffi.cdef[[
typedef void (*sighandler_t) (int32_t);
extern sighandler_t signal (int32_t signum, sighandler_t handler);
unsigned int alarm(unsigned int seconds);
]]
@kenshinx
kenshinx / keepalived.backup.conf
Last active January 2, 2016 13:49
Keepalived HA configuration file. Used for fail-over
! Configuration File for keepalived
2
3 global_defs {
4 notification_email {
5 [email protected]
6 }
7 notification_email_from [email protected]
8 smtp_server mail.sina.com.cn
9 smtp_connect_timeout 30
10 router_id LVS_DEVEL_252
@kenshinx
kenshinx / keepalived.lvs.backup.conf
Last active June 13, 2018 11:47
Keepalived + LVS configuration template. VIP: 123.125.22.90 Master: 123.125.22.97 Backup: 123.125.22.98 RealServer1: 123.125.22.99 RealServer2: 123.125.22.100 Loadbalance algorithm: wrr Loadbalance type: DR
! Configuration File for keepalived
global_defs {
notification_email {
[email protected]
}
notification_email_from [email protected]
smtp_server mail.sina.com.cn
smtp_connect_timeout 30
router_id LVS_1
@kenshinx
kenshinx / haproxy.conf
Created January 15, 2014 09:29
Haproxy load balance. haproxy:123.125.22.97 server1:123.125.22.99 server2:123.125.22.100
# this config needs haproxy-1.1.28 or haproxy-1.2.1
global
log 127.0.0.1 local3 debug
#log 127.0.0.1 local1 notice
#log loghost local0 info
maxconn 65535
#chroot /usr/share/haproxy
user haproxy
group haproxy