Skip to content

Instantly share code, notes, and snippets.

@feilaoda
feilaoda / gist:3984714
Created October 31, 2012 03:59 — forked from observerss/gist:3798922
Google Keyword Tool Scraper(casperjs version)
// requires
var utils = require('utils');
var casper = require('casper').create()
var casper = require('casper').create({
verbose: true,
logLevel: "debug"
});
// setup globals
var email = casper.cli.options['email'] || 'REPLACE THIS EMAIL';
@feilaoda
feilaoda / gist:4043548
Created November 9, 2012 03:35 — forked from cuimuxi/gist:3719516
gevent crawler
import gevent
from gevent import monkey, queue
monkey.patch_all()
import urllib2
from time import sleep
import traceback
import logging
@feilaoda
feilaoda / gist:4043549
Created November 9, 2012 03:35 — forked from cuimuxi/gist:3719535
gevent crawler test
from gcrawler import GCrawler, Downloader
import unittest
import urllib2
import logging
import traceback
from datetime import datetime
import re
logging.basicConfig(level=logging.DEBUG)
@feilaoda
feilaoda / marktodo规范
Created January 17, 2013 02:52
marktodo规范
Marktodo: A syntax for TODO lists
#any.do#
=project name
-todo list
[-] todo item A
[=] doing item B
[+] done item C
+done list
[+] done item a
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048

Introduction to Kafka

Kafka acts as a kind of write-ahead log (WAL) that records messages to a persistent store (disk) and allows subscribers to read and apply these changes to their own stores in a system appropriate time-frame.

Terminology:

  • Producers send messages to brokers
  • Consumers read messages from brokers
  • Messages are sent to a topic
# /etc/security/limits.conf
* soft nofile 999999
* hard nofile 999999
root soft nofile 999999
root hard nofile 999999
===========================================================
# /etc/sysctl.conf
# sysctl for maximum tuning
@feilaoda
feilaoda / hello.c
Created August 18, 2014 23:36 — forked from darcyliu/hello.c
#include <stdio.h>
#include <stdlib.h>
int main(){
//while(1){};
//sleep(5);
char *p;
long x = 10000,y=1000000;
while(x-->0){
while(y-->0){
//printf("%ld %ld\n",x,y);
<html>
<head>
<title></title>
<script type="text/javascript">
var tdist={ '210184':['沈北新区','210100','shen bei xin qu'], '210185':['其它区','210100','qi ta qu'], '420381':['丹江口市','420300','dan jiang kou shi'], '420383':['其它区','420300','qi ta qu'], '420382':['城区','420300','cheng qu'], '210182':['浑南新区','210100','hun nan xin qu'], '140800':['运城市','140000','yun cheng shi'], '210183':['张士开发区','210100','zhang shi kai fa qu'], '140802':['盐湖区','140800','yan hu qu'], '210181':['新民市','210100','xin min shi'], '140829':['平陆县','140800','ping lu xian'], '210203':['西岗区','210200','xi gang qu'], '140828':['夏县','140800','xia xian'], '210202':['中山区','210200','zhong shan qu'], '140830':['芮城县','140800','rui cheng xian'], '210200':['大连市','210000','da lian shi'], '140825':['新绛县','140800','xin jiang xian'], '140824':['稷山县','140800','ji shan xian'], '140827':['垣曲县','140800','yuan qu xian'], '140826':['绛县','140800','jiang xian'], '210204':['沙河口区','210200','sha he kou qu'], '140821':['临猗县','140800','lin yi xian'], '140823':['闻喜县','1