Skip to content

Instantly share code, notes, and snippets.


Chunliang Lyu cllu

View GitHub Profile
cllu /
Created Dec 11, 2014
Python 3 asynchronous HTTP request with aiohttp and asyncio
import asyncio
import aiohttp
def _crawl_url(url):
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
import os
import sys
import re
import hashlib
import csv
import time
import locale
import getopt
cllu /
Last active Nov 25, 2015
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 / hn_seach.js
Last active Dec 9, 2015 — forked from meiamsome/hn_search.js
HackerNews Who is Hiring TamperMonkey Script
View hn_seach.js
// ==UserScript==
// @name HackerNews WhosHiring
// @namespace
// @version 0.1
// @description try to take over the world!
// @author You
// @match*
// @grant none
// ==/UserScript==
/* jshint -W097 */

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 -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.

cllu / cllu_pinyin.dict.yaml
Last active Jan 11, 2016
Rime Custom Schema
View cllu_pinyin.dict.yaml
# 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
View markdown draft-js
<!DOCTYPE html>
<meta charset="utf-8" />
<title>Draft • Decorators</title>
<link rel="stylesheet" href="../../dist/Draft.css" />
<div id="target"></div>
<script src="../../node_modules/react/dist/react.js"></script>
cllu / CustomParser.php
Last active Mar 31, 2016
MediaWiki custom parser
View CustomParser.php
# Confirm MediaWiki environment
if (!defined('MEDIAWIKI')) die();
# Credits
$wgExtensionCredits['other'][] = array(
'author'=>'Chunliang Lyu',
cllu / index.html
Created Jul 8, 2016
Reveal.js for MediaWiki
View index.html
<!doctype html>
<html lang="en">
<meta charset="utf-8">
<title>reveal.js – The HTML Presentation Framework</title>
<meta name="description" content="A framework for easily creating beautiful presentations using HTML">
<meta name="author" content="Hakim El Hattab">
cllu /
Last active Sep 25, 2016
GitHub Wiki TamperMonkey script

GitHub Wiki TamperMonkey script

  • add word count
  • remove unused stuff
  • add Table of Content to the right column
  • Add keyboard shortcuts: double click content area to edit

The script matches only wikis on my own GitHub repos, change it according to your preferences:

You can’t perform that action at this time.