Skip to content

Instantly share code, notes, and snippets.

View leopku's full-sized avatar

Song Liu leopku

View GitHub Profile
@leopku
leopku / fakeldap.rb
Created September 22, 2016 09:39 — forked from krobertson/fakeldap.rb
fakeldap - fake data generator for LDAP
#
# Ugly little script I used when I needed to generate an LDAP DB with 100k sample users
#
require 'rubygems'
require 'faker'
require 'active_ldap'
ActiveLdap::Base.establish_connection(
:host => '10.0.0.8',
SASS_BINARY_SITE=https://npm.taobao.org/mirrors/node-sass/ npm install node-sass
@leopku
leopku / auto_install_sublime_packages.markdown
Created August 18, 2016 08:58 — forked from vishaltelangre/auto_install_sublime_packages.markdown
[Automate Packages Installation in Sublime Text 2] -- Automatically install Sublime Text 2 packages (some necessary ones, w/o fucking crap ones which makes sublime alike hell!)
  • To install packages, every time pressing ' ctrl+shift+pPackage Control: Install Package is very cumbersome task... right?

  • After fresh installation of ST2, open it and ctrl+` and hit enter after pasting below line [(1)][1]:

  import urllib2,os; pf='Package Control.sublime-package'; ipp=sublime.installed_packages_path(); os.makedirs(ipp) if not os.path.exists(ipp) else None; urllib2.install_opener(urllib2.build_opener(urllib2.ProxyHandler())); open(os.path.join(ipp,pf),'wb').write(urllib2.urlopen('http://sublime.wbond.net/'+pf.replace(' ','%20')).read()); print('Please restart Sublime Text to finish installation')
  • Restart ST2.

  • Open terminal, and navigate to Sublime's dir under your home folder by below command and create file w/ name Package Control.sublime-settings there in:

@leopku
leopku / simple_args_parsing.sh
Created March 2, 2016 07:06 — forked from jehiah/simple_args_parsing.sh
a simple way to parse shell script arguments
#!/bin/sh
#
# a simple way to parse shell script arguments
#
# please edit and use to your hearts content
#
ENVIRONMENT="dev"
@leopku
leopku / proxy.rb
Last active August 29, 2015 14:27 — forked from tomlea/proxy.rb
Rack Middleware to proxy requests to a remote server. This is usefull for proxying AJAX request to remote services.
require "net/http"
require "enumerator"
# Example Usage:
#
# use Rack::Proxy do |req|
# if req.path =~ %r{^/remote/service.php$}
# URI.parse("http://remote-service-provider.com/service-end-point.php?#{req.query}")
# end
# end
set -e
title='千尋影視' # dmg 文件 mount 了之后在文件系统中显示的名称
background_picture_name='mac-dmg-bg.png' # dmg 文件在 mount 了之后界面中显示的背景图片路径
application_name='千尋影視.app' # 应用程序的名称
# Developer ID 证书的名称(名字的一部分即可,但是需要能在 Keychain Access 中唯一定位到该证书)
developer_id='Developer ID Application: Shanghai Truecolor Multimedia'
# dmg 窗口相关的一些设置,需要根据实际情况做变更
window_left=200 # 窗口位置的 x 坐标
@leopku
leopku / Animated signing of signature (SVG paths).markdown
Created June 21, 2015 01:50
Animated signing of signature (SVG paths)

Animated signing of signature (SVG paths)

animate writing a signature with SVG stroke-dashoffset/stroke-dasharray and CSS transitions

A Pen by Gary Hepting on CodePen.

License.

@leopku
leopku / index.html
Last active August 29, 2015 14:23 — forked from anonymous/index.html
<!DOCTYPE html>
<html>
<head>
<script src="https://code.jquery.com/jquery-1.11.1.min.js"></script>
<meta charset="utf-8">
<title>JS Bin</title>
</head>
<body>
<path d="
M 18 191 L 58.1684 191 L 58.1684 129.1406 L 73.5454 112.6903
@leopku
leopku / clone
Created June 14, 2015 02:32
deep copy in javascript
function clone(obj) {
// Handle the 3 simple types, and null or undefined
if (null == obj || "object" != typeof obj) return obj;
// Handle Date
if (obj instanceof Date) {
var copy = new Date();
copy.setTime(obj.getTime());
return copy;
}
@leopku
leopku / info.sh
Last active August 29, 2015 14:11 — forked from mikepenz/multitail.md
# Run following command:
curl https://gist.githubusercontent.com/mikepenz/a8a4a52f67a391895a4c/raw/22db5a0c3b009442a9ff8fd454e08f429d706c8c/multitail.sh | sh; source ~/.bashrc
# This will start the script multitail.sh and call source ~/.bashrc afterwards
#try to run
#logt (log-tomcat) output normal /usr/local/tomcat/logs/catalina.out or /var/www/tomcat/logs/catalina.out
logt
#logt (log-tomcat) output overwrite tomcat or logfile /usr/local/$1/logs/$2 or /var/www/$1/logs/$2
logt $1 $2