Skip to content

Instantly share code, notes, and snippets.

@lneoe
lneoe / firewall.sh
Created December 10, 2013 05:48 — forked from x1a0/firewall.sh
#! /bin/bash
# Set the default policies to allow everything while we set up new rules.
# Prevents cutting yourself off when running from remote SSH.
iptables -P INPUT ACCEPT
iptables -P FORWARD ACCEPT
iptables -P OUTPUT ACCEPT
# Flush any existing rules, leaving just the defaults
iptables -F
@lneoe
lneoe / WorkDay.py
Created October 21, 2014 13:46
偶尔会用到这样的一个功能,给定两个日期和休息日计算之间的工作日天数
# coding:utf8
u"""偶尔会用到这样的一个功能,给定两个日期和休息日计算之间的工作日天数."""
import datetime
def workday(start_date, end_date, weekends=None):
"""根据给定的起止日期和周末来计算之间的工作日天数"""
@lneoe
lneoe / FunnyPi.sublime-project
Created February 4, 2015 03:23
项目配置 anaconda 使用 ping tangon
"settings":
{
"anaconda_linting": true,
"anaconda_linting_behaviour": "always",
"python_interpreter": "/usr/local/bin/python3",
"test_command": "python3 -m unittest discover",
"use_pylint": false,
"validate_imports": true
}
@lneoe
lneoe / Pycharm CE support django-console
Created June 27, 2015 02:04
PyCharm CE Django-console
import sys
print('Python %s on %s' % (sys.version, sys.platform))
import django
print('Django %s' % django.get_version())
sys.path.extend([WORKING_DIR_AND_PYTHON_PATHS])
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "your_project_.settings")
if 'setup' in dir(django):
django.setup()
# import django_manage_shell
@lneoe
lneoe / .screenrc
Created August 15, 2015 07:58
my .screenrc
# Bind F11 and F12 (NOT F1 and F2) to previous and next screen window
bindkey -k F1 prev
bindkey -k F2 next
startup_message off
# Window list at the bottom.
hardstatus alwayslastline
hardstatus string "%-w%{= BW}%50>%n %t%{-}%+w%<"
@lneoe
lneoe / mysql隔离级别及事务传播
Created December 16, 2015 03:24 — forked from JagoWang/mysql隔离级别及事务传播
mysql隔离级别及事务传播
TRANSACTION(事务隔离级别)
1. ISOLATION_DEFAULT:这是一个PlatfromTransactionManager默认的隔离级别,使用数据库默认的事务隔离级别。
每种数据库的默认隔离级别是不同的,例如SQL Server、Oracle默认Read Commited,MySQL默认Repeatable Read。
另外四个与JDBC的隔离级别相对应,不同的隔离级别采用不同的锁类型来实现,在四种隔离级别中,Serializable的
隔离级别最高,Read Uncommited的隔离级别最低。
2. ISOLATION_READ_UNCOMMITTED:读未提交数据,这是事务最低的隔离级别,在并发的事务中,它充许一个事务可以
读到另一个事务未提交的更新数据。(会出现脏读,不可重复读和幻读)
3. ISOLATION_READ_COMMITTED:读已提交数据,保证在并发的事务中,一个事务修改的数据提交后才能被另外一个事
@lneoe
lneoe / .tmux.conf
Last active April 6, 2017 13:54
tmux.conf
set -g default-terminal "tmux-256color"
# 重新读取加载配置文件
bind R source-file ~/.tmux.conf \; display-message "Config reloaded..."
set -g history-limit 10000
setw -g monitor-activity on
set -g visual-activity on
@lneoe
lneoe / .bash_profile
Created May 22, 2016 10:09
enable_disable_http_proxy
function enable_proxy(){
export http_proxy=http://127.0.0.1:8118
export https_proxy=http://127.0.0.1:8118
}
function disable_proxy(){
unset http_proxy https_proxy
}
@lneoe
lneoe / mpv.conf
Created May 30, 2016 12:12
mpv 配置
# Video
display-fps=60
autofit=100%x100%
# Volume
volume=100
# Subtitles
sub-auto=fuzzy
sub-text-font-size=48
# 你可以从该 URL 下载这个配置文件: http://surge.run/config-example/ios.conf
# 用编辑器编辑后,再通过 iTunes, URL, AirDrop 或者 iCloud Drive 复制回 iOS 设备
# Version 2.0
[General]
# 日志等级: warning, notify, info, verbose (默认值: notify)
loglevel = notify
# 跳过某个域名或者 IP 段,这些目标主机将不会由 Surge Proxy 处理。(在 macOS
# 版本中,如果启用了 Set as System Proxy, 那么这些值会被写入到系统网络代理
# 设置中.)