Skip to content

Instantly share code, notes, and snippets.

View lxyu's full-sized avatar

Lixin Yu lxyu

View GitHub Profile
@lxyu
lxyu / 0_reuse_code.js
Created July 31, 2017 02:51
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@lxyu
lxyu / guide.md
Created April 25, 2016 17:47
SS everywhere for asus merlin (working with openvpn server and ss-server)

OpenVPN Server

选择 automatic 引入的防火墙配置问题,默认规则里面有一行:

iptables -t nat -I PREROUTING -p tcp -m tcp --dport 1194 -j ACCEPT

使连接直接进入 ACCEPT 而跳过了 SHADOWSOCKS chain。

@lxyu
lxyu / test.py
Created January 22, 2016 04:35
Python daemon stdout flush demo
import threading
import sys
import time
import logging
logging.basicConfig(level=logging.INFO)
def handle():
while True:
@lxyu
lxyu / firefoxmini.css
Created December 14, 2015 16:13
Firefox Mini
@namespace url(http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul);
:root {
/* TAB VARIABLES */
--bg-light: #17181A; --bg-dark: #222326;
--fg-light: #EBECEE; --fg-dark: #AAABAD;
--tab-height: 24px; --tab-icon-size: 16px; --tab-strip-margin: -12px; --tab-overlap: -5px;
--tab-fonts: "terminus", "Dejavu Sans"; --tab-font-size: 13px;
--tab-triangle: block; /* block |
@lxyu
lxyu / pip-install.md
Created July 15, 2015 07:41
Gevent install log on archlinux
$ sudo pip install gevent==1.1a2
Collecting gevent==1.1a2
  Using cached gevent-1.1a2.tar.gz
Requirement already satisfied (use --upgrade to upgrade): greenlet>=0.4.7 in /usr/lib/python3.4/site-packages (from gevent==1.1a2)
Building wheels for collected packages: gevent
  Running setup.py bdist_wheel for gevent
  Complete output from command /usr/bin/python -c "import setuptools;__file__='/tmp/pip-build-lfmpuicl/gevent/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" bdist_wheel -d /tmp/tmp5n4kq__mpip-wheel-:
  running bdist_wheel
  running build
@lxyu
lxyu / mini.css
Created May 9, 2015 02:50
Firefox Mini
@namespace url(http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul);
:root {
/* TAB VARIABLES */
--bg-light: #17181A; --bg-dark: #222326;
--fg-light: #EBECEE; --fg-dark: #AAABAD;
--tab-height: 24px; --tab-icon-size: 16px; --tab-strip-margin: -12px; --tab-overlap: -5px;
--tab-fonts: "terminus", "Dejavu Sans"; --tab-font-size: 13px;
--tab-triangle: block; /* block |
@lxyu
lxyu / t1.md
Last active August 29, 2015 14:10
pymysql + gevent + sqlalchemy connection error log
$ pip freeze
gevent==1.0.1
PyMySQL==0.6.2
SQLAlchemy==0.9.8
..........................................X.................................................................X..................................................................................X........................................................................X.....................................................................................ERROR:sqlalchemy.pool.QueuePool:Exception during reset or similar
Traceback (most recent call last):
@lxyu
lxyu / PKGBUILD
Created June 26, 2014 02:42
haproxy-1.5.1 AUR for vps
pkgname=haproxy
pkgver=1.5.1
pkgrel=1
pkgdesc="The Reliable, High Performance TCP/HTTP Load Balancer"
arch=('i686' 'x86_64')
url="http://haproxy.1wt.eu"
license=('GPL')
depends=('pcre' 'openssl' 'zlib')
makedepends=('gcc' 'linux-headers')
backup=('etc/haproxy/haproxy.cfg')
@lxyu
lxyu / init.py
Last active August 29, 2015 14:02
Dynamic generate function with ordered default kwargs in python
import types
def init_generator(spec):
"""Generate `__init__` function based on spec
"""
varnames, defaults = zip(*spec)
varnames = ('self', ) + varnames
def init(self):
@lxyu
lxyu / scope.py
Created December 20, 2013 13:44
python for loop scope
import copy
class B(object):
def __init__(self, name):
self.name = name
class A(object):
def __init__(self):