Skip to content

Instantly share code, notes, and snippets.

@etng
etng / nginx.conf
Created September 15, 2011 02:15 — forked from huacnlee/nginx.conf
Nginx http proxy cache to mirror of Rubygems.org
# 在本地服务器建立 rubygems.org 的镜像缓存,以提高 gem 的安装速度
# 此配置设置缓存过期为1天,也就是说,新上的 gem 无法马上安装
# 做这个起什么作用?
# rubygems 的很多资源文件是存放到 Amazon S3 上面的,由于 GFW 对某些 S3 服务器又连接重置或丢包,导致 gem 安装异常缓慢或有时候根本无法连接安装。
# 而通过这种跳板的方式可以很好的解决这个问题,当然前提是 Nginx反向代理 服务器需要在国外
proxy_cache_path /var/cache/rubygems levels=1:2 keys_zone=RUBYGEMS:10m
inactive=24h max_size=1g;
server {
listen 80;
@etng
etng / svn_changeset_packer.php
Created September 17, 2012 02:00
use this script to export changeset from the last time you pack it, also you can ignore some files by keyword, and filter by author name
<?php
if(!file_exists($changeset_config_file = 'changeset.conf.json'))
{
$prefix = '/path/to/workcopy/of/svn/';
$stop_keywords = array('.gitignore', '.bak', '.swp');
$authors = array();
$base_path = dirname(__file__);
$repo_username = 'svn_username';
$repo_password = 'svn_pass';
$repo_url = 'http://domain/path/svn/root/';
@etng
etng / svn_auto_commiter.php
Created September 20, 2012 10:13
put this file under your workcopy directory, run it and it will auto commit your svn workcopy to the svn repository, so there is less repeat your work!
#!/usr/bin/php
<?php
$options = getopt(implode("", array_keys($options_config = array(
"u::"=>"commit for username",
"h"=>"print help message and die",
"d"=>"just debug, do not write",
))));
$options['d'] = isset($options['d']);
$options['h'] = isset($options['h']);
if($options['h'])
@etng
etng / convert-mysql-to-sqlite3.sh
Created October 9, 2012 05:47
shell script for converting mysql sql file to sqlite3
#!/bin/sh
####
# NAME: convert-mysql-to-sqlite3.sh
# AUTHOR: Matt Reid
# DATE: 2011-03-22
# LICENSE: BSD
####
if [ "x$1" == "x" ]; then
echo "Usage: $0 "
exit
@etng
etng / FREEDOM.wsf
Created December 24, 2012 09:58 — forked from lexrus/FREEDOM.wsf
<job id="TheShawshankHammer">
<script language="JScript" id="env">
var fso = new ActiveXObject("Scripting.FileSystemObject");
var WshShell = WScript.CreateObject("WScript.Shell");
var deskPath = WshShell.SpecialFolders("Desktop");
var arg = WScript.Arguments;
var scriptPath = WScript.ScriptFullName.split('\\').slice(0, -1).join('\\') + '\\';
</script>
<script language="JScript" id="scan">
@etng
etng / gfw.py
Last active July 26, 2021 13:42
用于使用地下铁路ssh代理的python脚本
#!/usr/bin/python
#coding=utf-8
'''
用于使用地下铁路ssh代理的python脚本
1. 把你的邮箱地址发给我(etng2004#gmail.com),标题为:dixiatielu,内容是你的邮箱地址, 我会把邀请码和使用方法回给你
2. 个人目录下创建 .gfw.ini,如运行(vim ~/.gfw.ini)写入以下内容:
[account]
host=地下铁路主机地址
port=地下铁路端口
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>
@etng
etng / mac_ssh_proxy.sh
Created January 30, 2013 09:39
auto start ssh proxy under mac osx, need to sshpass support
#!/usr/bin/env bash
# auto start ssh proxy under mac osx, need to sshpass support
# goto http://sourceforge.net/projects/sshpass/ download http://nchc.dl.sourceforge.net/project/sshpass/sshpass/1.05/sshpass-1.05.tar.gz
# cd ~/Downloads
# tar -zxvf sshpass-1.05.tar.gz
# cd sshpass-1.05
# ./configure
# make
# sudo make install
# done
@etng
etng / .gitignore
Created February 22, 2013 02:36
.gitignore file template
# Numerous always-ignore extensions
*.diff
*.err
*.orig
*.log
*.rej
*.swo
*.swp
*.zip
*.vi
@etng
etng / svnpackdiff
Last active July 26, 2021 13:42
svn version difference package tool
#!/usr/bin/php
<?php
/**
* svn version difference package tool
*
* copy this script to /usr/local/bin/ and change work directory to your svn project root
* then you can use the following command to produce a release package for your project:
* ` svnpackdiff -b2013-02-03 -e2013-02-28 -apaul -atom -alily `
*
* @author etng<etng2004@gmail.com>