Skip to content

Instantly share code, notes, and snippets.

@missinglink
missinglink / aggregations.sh
Created December 1, 2014 09:53
aggregate per-region index statistics for pelias.
#!/bin/bash
curl -s -X POST "localhost:9200/pelias/_search?pretty=true&search_type=count" -d '
{
"size": 0,
"aggs": {
"group_by_a3": {
"terms": {
"field": "alpha3"
},
@hjue
hjue / remove-google-redirect.user.js
Created September 13, 2014 01:07
UserScripts: 消除google结果跳转
// ==UserScript==
// @name 禁止google结果跳转
// @namespace http://blog.whosemind.net
// @description 去掉google搜索结果的跳转(http://www.google.com/url?), 而直接用原始链接
// @version 0.0.7
// @include /^https?:\/\/www\.google\.[^\/]+?\/(#.*|webhp.*|search\?.*)?$/
// ==/UserScript==
var eles,
timer,
s,
@coderplay
coderplay / ViewDirectByteBuffer.md
Last active December 22, 2015 10:29
Direct ByteBuffer的内存查看

Java应用中经常用ByteBuffer.allocateDirect()或者Unsafe.allocateMemory()分配一段内存。 MAT等内存查看器看不到native的内存, 所以需要借助gdb等工具来查看.

ByteBuffer bb = ByteBuffer.allocateDirect(capacity)
                              .order(ByteOrder.nativeOrder());

这种ByteBuffer可以得到它的起始内存地址

Performance of Flask, Tornado, GEvent, and their combinations

Wensheng Wang, 10/1/11

Source: http://blog.wensheng.org/2011/10/performance-of-flask-tornado-gevent-and.html

When choosing a web framework, I pretty much have eyes set on Tornado. But I heard good things about Flask and Gevent. So I tested the performance of each and combinations of the three. I chose something just a little more advanced than a "Hello World" program to write - one that use templates. Here are the codes:

1, Pure Flask (pure_flask.py)

@SaitoWu
SaitoWu / graph.rb
Last active December 25, 2017 07:30
Github Contribution Graph
require 'date'
author = "Saito"
email = "[email protected]"
date = Date.new(2012, 7, 30)
s = %w{
. . . . . . .
. . o o o . .
. o . . . . .
@ambar
ambar / ie6_crash.html
Created December 21, 2011 12:32
如何改善百度统计引入代码
<html>
<head>
<title></title>
</head>
<body>
<div>
<script>
document.body.appendChild( document.createElement('script') )
</script>