Skip to content

Instantly share code, notes, and snippets.

View Lax's full-sized avatar

Liu Lantao Lax

View GitHub Profile
@Lax
Lax / ajaxify-html5.js
Created April 8, 2012 15:49
Ajaxify a Website with the HTML5 History API using History.js, jQuery and ScrollTo
// https://gist.github.com/854622
(function(window,undefined){
// Prepare our Variables
var
History = window.History,
$ = window.jQuery,
document = window.document;
// Check to see if History.js is enabled for our Browser
@Lax
Lax / README.md
Created December 27, 2013 01:58
nginx_variables_quickref

About this list

This is a quick-ref for various nginx variables.

Conventions

### Module name

* $variable_name

defination/usage

@Lax
Lax / ipaddr_demo.rb
Created January 13, 2014 08:25
Ruby IPAddr class, inet_aton and inet_ntoa equivalence.
require 'ipaddr'
IPAddr.new("192.168.0.1").to_i
=> 3232235521
IPAddr.new(3232235521, Socket::AF_INET).to_s
=> "192.168.0.1"
/*
* Copyright (c) 2013 by Wil Tan <wil@cloudregistry.net>
*
* Based on dump_dns.c from the dnscap <https://www.dns-oarc.net/tools/dnscap>
* originally written by Paul Vixie.
*
* Copyright (c) 2007 by Internet Systems Consortium, Inc. ("ISC")
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@Lax
Lax / README.md
Last active August 29, 2015 14:01
IP-LOCATION-ISP

IP-LOCATION-ISP

# A quick and dirty plugin for Jekyll by Eli Naeher
#
# This plugin creates a site.years template variable which allow you to group archive links by year and month.
# The structure of site.years is:
# site.years = 2001=>[[post1, post2...], [...]], 2002=>[...]
#
# Usage should look something like this:
# {% for year in site.years %}
# <h2>Year {{ year.first.first.date | date: "%Y" }}</h2>
@Lax
Lax / rewrite_by_lua.conf
Created September 12, 2014 03:19
(nginx.conf) rewrite by lua, for SEO, etc.
rewrite_by_lua '
REDIR_R = {
["/r/1"] = "/d/1",
["/r/2"] = "/d/2",
}
if REDIR_R[ngx.var.uri] then
return ngx.redirect(REDIR_R[ngx.var.uri]);
end
';
@Lax
Lax / README.md
Last active August 29, 2015 14:07 — forked from nikcub/README.md
@Lax
Lax / .gitignore
Last active August 29, 2015 14:10
aliyun_cli
aliyun.yml
*.csv
require 'socket'
require 'pp'
require 'xdr'
# Inspiration
# https://github.com/fastly/ganglia/blob/master/lib/gm_protocol.x
# https://github.com/igrigorik/gmetric/blob/master/lib/gmetric.rb
# https://github.com/ganglia/monitor-core/blob/master/gmond/gmond.c#L1211
# https://github.com/ganglia/ganglia_contrib/blob/master/gmetric-python/gmetric.py#L107