Skip to content

Instantly share code, notes, and snippets.

@cllu
cllu / README.md
Last active November 25, 2015 07:18
LeetCode OJ Tampermonkey script

LeetCode OJ modifier

  • hide the LeetCode Premium Subscription and Books links on the top navigation bar, since I have already subscribed.
  • hide the chat link, hide the footer
  • hide the FAQ block on the right column for the discussion page
  • display the question id on the problem page
  • display number of solved/total problems on the /company/ page
@cllu
cllu / wechat2txt.py
Last active August 29, 2015 14:20 — forked from scturtle/wechat2txt.py
import os
import sys
import re
import hashlib
import csv
import time
import locale
import getopt
@cllu
cllu / cllu_pinyin.dict.yaml
Last active January 11, 2016 18:47
Rime Custom Schema
# Rime dictionary
# encoding: utf-8
---
name: cllu_pinyin
version: "2014.12.24"
sort: by_weight
use_preset_vocabulary: true
# import dict from luna_pinyin.dict.yaml
import_tables:
@cllu
cllu / aync-http-requests.py
Created December 11, 2014 10:38
Python 3 asynchronous HTTP request with aiohttp and asyncio
import asyncio
import aiohttp
def _crawl_url(url):
try:
resp = yield from asyncio.wait_for(aiohttp.request('GET', url, allow_redirects=True), 10)
""":type resp: aiohttp.client.ClientResponse"""
resp.text = yield from asyncio.wait_for(resp.text(), 10)
return resp

Making use of the Stanford NLP Socket Server

Stanford NER tagger can be started listening to socket easily, which is documented as in the README file.

java -mx1000m -cp $HOME/resources/stanford/tagger/stanford-ner.jar edu.stanford.nlp.ie.NERServer -loadClassifier $HOME/resources/stanford/tagger/classifiers/english.all.3class.distsim.crf.ser.gz -port 1234

The POS tagger also has a built-in MaxentTaggerServer, however, we cannot directly use it.