Skip to content

Instantly share code, notes, and snippets.

View CarlLee's full-sized avatar

Carl Lee CarlLee

  • Chongqing China
View GitHub Profile
@CarlLee
CarlLee / parallel_crawler.go
Last active August 31, 2015 00:50
An implementation of Go tour exercise, https://tour.golang.org/concurrency/9
package main
import (
"fmt"
)
type Fetcher interface {
// Fetch returns the body of URL and
// a slice of URLs found on that page.
Fetch(url string) (body string, urls []string, err error)
@CarlLee
CarlLee / async_conditioning2.js
Last active August 29, 2015 12:09
async_conditioning with [async module](https://github.com/caolan/async)
var async = require('async');
var bools = {};
function check1(){
// do something
bools['check1'] = condition1;
}
function check2(){
// do other things
bools['check2'] = condition2;
@CarlLee
CarlLee / async_conditioning.js
Last active August 29, 2015 11:57
checking multiple conditions asynchronously
var bools = {};
function check1(){
// do something
bools['check1'] = condition1;
finalChek();
}
function check2(){
// do other things
bool['check2'] = condition2);
@CarlLee
CarlLee / callback.c
Created August 25, 2015 16:04
Demonstration of "callback function" in C
void *(mouse_listener)(int, int);
// Print coordinates if mouse is clicked
void on_mouse_clicked(int x, int y){
printf("%d, %d", x, y);
}
// Tell other code what to do when mouse is clicked by registering a event listener
void register_mouse_listener(void *(func_pointer)(int, int)){
mouse_listener = func_pointer;
@CarlLee
CarlLee / gf.java
Last active August 29, 2015 14:28
if(she.getFaceValue() >= 90 &&
she.getBreastSize().compare(new BreastSize("36D")) >= 0){
this.sleepWith(she);
if(this.getHappiness() >= 60){
this.setGirlFriend(she);
int prevHappiness = this.getHappiness();
// Wait for 2 months
Thread.sleep(1000 * 3600 * 24 * 30 * 2);
if(this.getHappiness() - prevHappiness >= 15){
@CarlLee
CarlLee / phishing_counter.py
Last active March 9, 2019 01:17
反钓鱼脚本
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import urllib2, urllib, random, struct, threading, time
FISRT_NAME_DATA = (
'赵','钱','孙','李','周','吴','郑','王','冯','陈',
'褚','卫','蒋','沈','韩','杨','朱','秦','尤','许',
'何','吕','施','张','孔','曹','严','华','金','魏',
'陶','姜','戚','谢','邹','喻','柏','水','窦','章',
'云','苏','潘','葛','奚','范','彭','郎','鲁','韦',
@CarlLee
CarlLee / app.js
Created August 13, 2015 16:07
Angular.js example
angular.module('app', [])
.controller('ItemsCtrl', function($scope, $http){
$scope = $http.get('items.json').success(function(data){
$scope.items = data;
});
});
<span>example<span style="display:none">WTF-NONE-SENSE-!@#!$!@$</span>@gmail.com</span>
{
"tag1": "明星",
"tag2": "刘诗诗",
"totalNum": 1314,
"start_index": 0,
"return_number": 30,
"data": [
{
"id": "4859542230",
"pn": 0,