This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// more django {{{ | |
// see http://www.daveoncode.com/2013/10/17/how-to-make-angularjs-and-django-play-nice-together/ | |
// }}} | |
// more angular {{{ | |
angular.module('main', ['ng']) | |
.config(['$httpProvider', function($httpProvider) { | |
angular.extend($httpProvider.defaults, { | |
withCredentials: true, | |
xsrfHeaderName: 'X-CSRFToken', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
-- https://svn.nmap.org/nmap/nselib/url.lua | |
-- URI parsing, composition, and relative URL resolution. | |
-- | |
-- A URL is represented as a table with the following entries: | |
-- * <code>scheme</code> | |
-- * <code>fragment</code> | |
-- * <code>query</code> | |
-- * <code>params</code> | |
-- * <code>authority</code> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
# head -c123456845 /dev/random | szstat >/dev/null | |
sub ps { | |
my $n=shift @_; | |
my @u=qw"B K M G T P E"; | |
my $i=0; | |
while ($n>=1024 and $i<$#u) { | |
$n /= 1024.0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var mus = require('mustache'); | |
var t = npgettext("abcadfadf a", "%(count)d app", "%(count)d apps", count); | |
function gettext_plural() { | |
return function(text, render) { | |
try { | |
var ctx = JSON.parse(text); | |
var count = parseInt(render(ctx[0]), 10); | |
return render(count > 1 && ctx[2] ? ctx[2] : ctx[1]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
angular.module('MyApp', []) | |
.controller('MyCtrl', ['$scope', '$debounce', function($scope, $debounce) { | |
$scope.val = 0; | |
$scope.inc = function() { | |
$debounce(increase, 300); | |
}; | |
var increase = function() { | |
$scope.val++; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 1. for: https://docs.newrelic.com/docs/features/request-queuing-and-tracking-front-end-time | |
# 2. as some guys ask this question for haproxy (seems can not do this): | |
# http://www.faultserver.com/q/answers-how-to-set-the-request-start-time-with-haproxy-447033.html | |
# 3. and, we can not add this header in httpd server, because it's too late.. | |
limit_req_zone $binary_remote_addr zone=one:1m rate=1r/s; | |
server { | |
listen 1025; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<meta charset="utf-8"> | |
<style> | |
circle { | |
stroke: #fff; | |
} | |
</style> | |
<body> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"> | |
<title>OMG Particles!</title> | |
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.js?1.25.0"></script> | |
<style type="text/css"> | |
body { | |
background: #222; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" <buffer-number> <file-name> <modify> <file-type> <encoding> <line><col> <byte-of-file> <char-under-cursor> <pos-of-file> | |
" #17 ~/.vimrc [+][vim] [utf-8] 2336,1 @59791 0x6E Bot | |
set statusline=%<#%n\ %f\ %h%m%r%y%=%k[%{(&fenc==\"\")?&enc:&fenc}%{(&bomb?\",bom\":\"\")}]\ %-16.(%l,%c%V%)\ @%o\ 0x%B\ %P | |
" use :grep to search | |
set grepprg=ack\ --nocolor\ --nogroup | |
set grepformat=%f:%l:%m | |
" use <C-j> and <C-k> to navigate in search result | |
nm <c-j> :cn<CR> | |
nm <c-k> :cp<CR> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* lisp.c: high-speed LISP interpreter */ | |
/* src: http://www.cs.auckland.ac.nz/~chaitin/lisp.c */ | |
/* | |
The storage required by this interpreter is 8 * 4 = 32 bytes times | |
the symbolic constant SIZE, which is 32 * 1,000,000 = | |
32 megabytes. To run this interpreter in small machines, | |
reduce the #define SIZE 1000000 below. | |
To compile, type | |
cc -O -olisp lisp.c |