Skip to content

Instantly share code, notes, and snippets.

View lnsoso's full-sized avatar

lnsoso lnsoso

  • Beijing
View GitHub Profile
# 你可以从该 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, 那么这些值会被写入到系统网络代理
# 设置中.)
@lnsoso
lnsoso / surge.conf
Created July 17, 2016 07:15
📦 Surge 安装步骤导览 | http://bit.ly/292EJz3
# 规则配置仅供参考,适用于 Surge iOS & Mac;
# 包含 Reject 规则,用于拦截广告、行为分析、数据统计
# 屏蔽部分运营商劫持网页弹出流量统计
# 部分特性可能仅适用于最新的 TestFlight 版本
# 参数说明 zhHans.conf.ini http://bit.ly/29kwXlZ
[General]
# warning, notify, info, verbose
loglevel = notify
bypass-system = 1

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

@lnsoso
lnsoso / time_convert.php
Created December 9, 2013 04:31
把 “2013 十二月 9 7:01” 这种日期格式处理成 PHP 标准的时间
<?php
date_default_timezone_set('Asia/Shanghai');
$str = '2013 十二月 9 7:01';
// @TODO : 添加更多的中/英文月份
$chs = array('十二月');
$eng = array('dec');
$str = str_replace($chs, $eng, $str);
$str = implode(array_reverse(explode(' ', $str)), ' ');

从 svn 迁移到 gitlab

找出所有提交者

$ svn log --xml | grep author | sort -u | perl -pe 's/.>(.?)<./$1 = /'

手动设置对应关系 users.txt

@lnsoso
lnsoso / watermark.py
Last active December 15, 2015 15:19
create watermarks with Python PIL
import Image, ImageEnhance, os
from os.path import join
def test():
batch("./src", "./dst", "./logo/watermark.png")
def batch(infolder, outfolder, watermark):
mark = Image.open(watermark)
for root, dirs, files in os.walk(infolder):
for name in files:
data:text/html, <style type="text/css">#e{position:absolute;top:0;right:0;bottom:0;left:0;}</style><div id="e"></div><script src="http://d1n0x3qji82z53.cloudfront.net/src-min-noconflict/ace.js" type="text/javascript" charset="utf-8"></script><script>var e=ace.edit("e");e.setTheme("ace/theme/monokai");e.getSession().setMode("ace/mode/ruby");</script>
/*
12306 Auto Submit => A javascript snippet to help you auto submit.
Copyright (C) 2011 Kevintop
Includes jQuery
Copyright 2011, John Resig
Dual licensed under the MIT or GPL Version 2 licenses.
http://jquery.org/license
Includes 12306.user.js
/*
12306 Auto Query => A javascript snippet to help you book tickets online.
Copyright (C) 2011-2012 Jingqin Lynn
Includes jQuery
Copyright 2011, John Resig
Dual licensed under the MIT or GPL Version 2 licenses.
http://jquery.org/license
Includes Sizzle.js
/*
12306 Auto Submit => A javascript snippet to help you auto submit.
Copyright (C) 2011 Kevintop
Includes jQuery
Copyright 2011, John Resig
Dual licensed under the MIT or GPL Version 2 licenses.
http://jquery.org/license
Includes 12306.user.js