Skip to content

Instantly share code, notes, and snippets.

View villadora's full-sized avatar

Wei Gao villadora

  • Ant,Tmall, DP, MS
  • Shanghai,China
View GitHub Profile
@villadora
villadora / logstash.grok.pattern
Created August 21, 2017 12:18
logstash grok pattern
USERNAME [a-zA-Z0-9._-]+
USER %{USERNAME}
INT (?:[+-]?(?:[0-9]+))
BASE10NUM (?<![0-9.+-])(?>[+-]?(?:(?:[0-9]+(?:\.[0-9]+)?)|(?:\.[0-9]+)))
NUMBER (?:%{BASE10NUM})
BASE16NUM (?<![0-9A-Fa-f])(?:[+-]?(?:0x)?(?:[0-9A-Fa-f]+))
BASE16FLOAT \b(?<![0-9A-Fa-f.])(?:[+-]?(?:0x)?(?:(?:[0-9A-Fa-f]+(?:\.[0-9A-Fa-f]*)?)|(?:\.[0-9A-Fa-f]+)))\b
POSINT \b(?:[1-9][0-9]*)\b
NONNEGINT \b(?:[0-9]+)\b
@villadora
villadora / logstash.grok.pattern
Created August 21, 2017 12:18
logstash grok pattern
USERNAME [a-zA-Z0-9._-]+
USER %{USERNAME}
INT (?:[+-]?(?:[0-9]+))
BASE10NUM (?<![0-9.+-])(?>[+-]?(?:(?:[0-9]+(?:\.[0-9]+)?)|(?:\.[0-9]+)))
NUMBER (?:%{BASE10NUM})
BASE16NUM (?<![0-9A-Fa-f])(?:[+-]?(?:0x)?(?:[0-9A-Fa-f]+))
BASE16FLOAT \b(?<![0-9A-Fa-f.])(?:[+-]?(?:0x)?(?:(?:[0-9A-Fa-f]+(?:\.[0-9A-Fa-f]*)?)|(?:\.[0-9A-Fa-f]+)))\b
POSINT \b(?:[1-9][0-9]*)\b
NONNEGINT \b(?:[0-9]+)\b
@villadora
villadora / latency.markdown
Created April 15, 2016 06:17 — forked from hellerbarde/latency.markdown
Latency numbers every programmer should know

Latency numbers every programmer should know

L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns             
Compress 1K bytes with Zippy ............. 3,000 ns  =   3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns  =  20 µs
SSD random read ........................ 150,000 ns  = 150 µs

Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs

Mathematical Creation

How is mathematics made? What sort of brain is it that can compose the propositions and systems of mathematics? How do the mental processes of the geometer or algebraist compare with those of the musician, the poet, the painter, the chess player? In mathematical creation which are the key elements? Intuition? An exquisite sense of space and time? The precision of a calculating machine? A powerful memory? Formidable skill in following complex logical sequences? A supreme capacity for concentration?

The essay below, delivered in the first years of this century as a lecture before the Psychological Society in Paris, is the most celebrated of the attempts to describe what goes on in the mathematician's brain. Its author, Henri Poincaré, cousin of Raymond, the politician, was peculiarly fitted to undertake the task. One of the foremost mathematicians of all time, unrivaled as an analyst and mathematical physicist, Poincaré was known also as a brilliantly lucid expositor of the philosophy

$adb shell
# change to root
su
# add read/write permission to /system
mount -o remount, rw /system
# copy
cat ApplicationName.apk > /system/app/ApplicationName.apk
# change permission of apk
chmod 644 ApplicationName.apk
# reboot device

compdef

complete

compctl

@villadora
villadora / 0_reuse_code.js
Created December 4, 2013 01:58
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@villadora
villadora / utm.md
Created October 31, 2013 02:36
utm

utm = Urchin Tracking Module

  1. write config file make a config.admin.js, config couchAuth for couch login, and registryCouch to couchdb; update =npm= change the registry address;

  2. start redis install redis, run:

    redis-server dev/redis/redis.conf

  3. start elasticsearch install elasticsearch, run:

@villadora
villadora / mysql-node-pool.js
Created September 4, 2013 03:06
usage for node-mysql-pool
var pool = mysql.createPool({
host: '127.0.0.1',
port: '3306',
user: 'root',
password: '123456',
database: 'test',
debug: process.env.NODE_ENV == 'debug'
});