Skip to content

Instantly share code, notes, and snippets.

Avatar

feythin lau feythin

View GitHub Profile
View gist:ea87e3a736550d7dd3a637ac9ee4530f
global
chroot /var/lib/haproxy
daemon
group haproxy
log 127.0.0.1 local0
maxconn 4000
pidfile /var/run/haproxy.pid
stats socket /var/lib/haproxy/stats
user haproxy
@feythin
feythin / haproxy.cfg
Created Mar 1, 2017 — forked from GABeech/haproxy.cfg
Stack Exchange HAProxy
View haproxy.cfg
# This is an example of the Stack Exchange Tier 1 HAProxy config
# The only things that have been changed from what we are running are:
# 1. User names have been removed
# 2. All Passwords have been remove
# 3. IPs have been changed to use the example/documentation ranges
# 4. Rate limit numbers have been changed to randome numbers, don't read into them
userlist stats-auth
group admin users $admin_user
user $admin_user insecure-password $some_password
View ansible-lineinfile-examples.yml
## credit: http://fabian-affolter.ch/blog/the-lineinfile-module-of-ansible/
---
- hosts: alpine_install
user: root
tasks:
# - name: create a complete empty file
# command: /usr/bin/touch /test/test.conf
- name: create a new file with lineinfile
@feythin
feythin / parallel_timed_rotating_handler.py
Created Apr 6, 2016 — forked from tawateer/parallel_timed_rotating_handler.py
重写 Python logging 的 TimedRotatingFileHandler doRollover 方法,解决多进程切割日志的问题。
View parallel_timed_rotating_handler.py
#!/bin/env python
# -*- coding: utf-8 -*-
import os
import time
import logging
from logging.handlers import TimedRotatingFileHandler
LOG_DIR = "/tmp/"
View nginx.conf
# 1. Make sure you have nginx sub module compiled in
# nginx -V 2>&1 | grep --color=always '\-\-with\-http_sub_module'
# 2. add two directives below at HTTP level
# nginx.conf
http {
# ......
sub_filter '</head>' '<style type="text/css">html{ filter:progid:DXImageTransform.Microsoft.BasicImage(grayscale=1); -webkit-filter: grayscale(100%); filter: url("data:image/svg+xml;utf8,<svg xmlns=\'http://www.w3.org/2000/svg\'><filter id=\'grayscale\'><feColorMatrix type=\'matrix\' values=\'0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0 1 0\'/></filter></svg>#grayscale"); /* Firefox 10+, Firefox on Android */
View asyncsrv.py
import zmq
import threading
import time
from random import choice
class ClientTask(threading.Thread):
"""ClientTask"""
def __init__(self):
threading.Thread.__init__ (self)
@feythin
feythin / git_Backup.py
Created Nov 30, 2012 — forked from mike-zhang/git_Backup.py
git备份程序
View git_Backup.py
import os
'''
.ssh/config (windows,for local git server):
Host host100
Hostname 192.168.1.100
User git
IdentityFile C:/Users/admin/.ssh/id_rsa_gitBackup_host100
repo example: