Skip to content

Instantly share code, notes, and snippets.

View YieldNull's full-sized avatar


View GitHub Profile
YieldNull / CParser.jj
Created October 27, 2015 07:28
C grammar defintion for use with JavaCC.(Copied from
C grammar defintion for use with JavaCC
Contributed by Doug South ( 21/3/97
This parser assumes that the C source file has been preprocessed : all
#includes have been included and all macros have been expanded. I accomplish
this with "gcc -P -E <source file> > <output file>".
There is a problem with compiler specific types, such as __signed, __const,
YieldNull /
Last active July 14, 2021 04:31








YieldNull /
Last active October 9, 2020 10:51
#!/usr/bin/env python
download files from using
use crontab to run it in a specific time interval to check if it has failed
if failed, restart it
Created on 2015.10.31
#!/usr/bin/env python
# coding:utf-8
A 'Crawler' for
import re
import urllib
import urllib2
YieldNull /
Last active April 15, 2020 11:09
Fork processes to handle TCP requests.
import os
import socket
def main():
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
sock.bind(('', 9999))
YieldNull /
Last active January 4, 2019 10:55
import sys
import logging
from multiprocessing.pool import Pool
logging.basicConfig(stream=sys.stdout, level=logging.INFO,
format='%(asctime)s - %(processName)s %(threadName)s - %(name)s - %(levelname)s - %(message)s')
if __name__ == "__main__":
def job(name):
logger = logging.getLogger(name)
YieldNull / ScalaInMemoryCompiler.scala
Created December 31, 2018 05:52
Scala In Memory Compiler
import{Global, Settings}
import scala.reflect.internal.util.BatchSourceFile
import{VirtualDirectory, AbstractFile}
import scala.reflect.internal.util.AbstractFileClassLoader
import java.math.BigInteger
import collection.mutable
object CompileTest {
YieldNull /
Created November 8, 2018 04:02
A Multithread Downloader
import os
import logging
import requests
from multiprocessing.pool import ThreadPool
from multiprocessing import Queue
def download(task_file, repository, pool_size=8):
logger = logging.getLogger('downloader')
logging.basicConfig(stream=sys.stdout, level=logging.INFO)
YieldNull /
Created November 17, 2015 15:27

#功能 备份QQ空间说说(先用浏览器登陆获取Cookie)

#用法 先将Cookie及用户写入config.json中,格式如下

YieldNull / R2LParser.c
Created November 1, 2015 12:44
Recognize C Pointer Declaration(识别C语言指针表达式)
* R2LParser.c
* Recognize C declaration use Right-Left Method(from
* The "right-left" rule is a completely regular rule for deciphering C
* declarations. It can also be useful in creating them.
* First, symbols. Read
* * as "pointer to" - always on the left side