Skip to content

Instantly share code, notes, and snippets.

View sdhjl2000's full-sized avatar
🎯
Focusing

jason hu sdhjl2000

🎯
Focusing
View GitHub Profile
@sdhjl2000
sdhjl2000 / gist:3949945
Created October 25, 2012 01:21
generate html
# coding=gbk
from pygments import highlight
from pygments.lexers import PythonLexer,CSharpLexer
from pygments.formatters import HtmlFormatter
from pygments.lexers import get_lexer_by_name
import os
@sdhjl2000
sdhjl2000 / gist:4223018
Created December 6, 2012 08:59
rashelper
using System;
using System.Linq;
using APSP.Form.Model;
using NHibernateRepository;
using NUnit.Framework;
using System.Collections.Generic;
using System.IO;
using System.Security.Cryptography;
using System.Text;
namespace APSPTest
@sdhjl2000
sdhjl2000 / gist:4256533
Created December 11, 2012 07:17
NHtmlUnit
using System;
using System.Linq;
using NHtmlUnit;
using NHtmlUnit.Html;
using NUnit.Framework;
using HtmlAgilityPack;
@sdhjl2000
sdhjl2000 / douban
Created December 30, 2012 09:59
douban reder
#encoding: utf-8
#author:t-y
#http://pythoner.net
import time,math,os,re,urllib,urllib2,cookielib
class douban_robot:
email = '[email protected]'
password = 'sdhjl200'
login_path = 'https://www.douban.com/accounts/login'

The introduction to Reactive Programming you've been missing

(by @andrestaltz)

So you're curious in learning this new thing called (Functional) Reactive Programming (FRP).

Learning it is hard, even harder by the lack of good material. When I started, I tried looking for tutorials. I found only a handful of practical guides, but they just scratched the surface and never tackled the challenge of building the whole architecture around it. Library documentations often don't help when you're trying to understand some function. I mean, honestly, look at this:

Rx.Observable.prototype.flatMapLatest(selector, [thisArg])

Projects each element of an observable sequence into a new sequence of observable sequences by incorporating the element's index and then transforms an observable sequence of observable sequences into an observable sequence producing values only from the most recent observable sequence.

@sdhjl2000
sdhjl2000 / cmd.sh
Last active August 29, 2015 14:19 — forked from kelvinn/cmd.sh
# post_loc.txt contains the json you want to post
# -p means to POST it
# -H adds an Auth header (could be Basic or Token)
# -T sets the Content-Type
# -c is concurrent clients
# -n is the number of requests to run in the test
ab -p post_loc.txt -T application/json -H 'Authorization: Token abcd1234' -c 10 -n 2000 http://example.com/api/v1/locations/
@sdhjl2000
sdhjl2000 / gist:059f649b2c34bacf8ebf
Created May 31, 2015 14:57
return first done or wait all
package main
import "fmt"
import (
"time"
)
//import "math/rand"
func main() {
#!/bin/sh
#
# /etc/rc.d/init.d/supervisord
#
# Supervisor is a client/server system that
# allows its users to monitor and control a
# number of processes on UNIX-like operating
# systems.
#
# chkconfig: - 64 36
@sdhjl2000
sdhjl2000 / gist:1c6a43656037735fdc32
Last active August 29, 2015 14:25
centos 6.X 安装tesseract进行图像识别

这两天在使用pillow完成图像识别的一个小任务,mac上配置起来还算方便,但是再centos服务器配置的时候遇到一些麻烦,记录下来

方案1:http://pkgs.org/download/tesseract,安装后和训练数据(https://code.google.com/p/tesseract-ocr/downloads/list)无法正常使用,提示actual_tessdata_num_entries <= TESSDATA_NUM_ENTRIES:Error:Assert failed:in file ..\ccutil\tessdatamanager.cpp,官方说法是训练文件不对应,但是安装了三个版本的tesseract都不行

方案2:手动安装,请参考https://www.simpleservers.co.uk/clients/whmcs/knowledgebase/600/Install-Tesseract-OCR-libs-from-sources-in-Centos.html

方案3:使用PUIAS_6_computational源

$ vim /etc/yum.repos.d/puias-computational.repo 粘贴:

@sdhjl2000
sdhjl2000 / centos安装shadowsocks.md
Last active August 29, 2015 14:25
centos安装shadowsocks