Skip to content

Instantly share code, notes, and snippets.

View YieldNull's full-sized avatar
😃

YieldNull

😃
View GitHub Profile
@YieldNull
YieldNull / ScalaInMemoryCompiler.scala
Created December 31, 2018 05:52
Scala In Memory Compiler
import scala.tools.nsc.{Global, Settings}
import scala.reflect.internal.util.BatchSourceFile
import tools.nsc.io.{VirtualDirectory, AbstractFile}
import scala.reflect.internal.util.AbstractFileClassLoader
import java.security.MessageDigest
import java.math.BigInteger
import collection.mutable
import java.io.File
object CompileTest {
@YieldNull
YieldNull / multithread_logging.py
Last active January 4, 2019 10:55
multithread_logging.py
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
YieldNull / sock_fork.py
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(('127.0.0.1', 9999))
sock.listen()
#!/usr/bin/env python
# coding:utf-8
"""
A 'Crawler' for http://msdn.itellyou.cn/
"""
import re
import urllib
import urllib2
@YieldNull
YieldNull / download.py
Last active October 9, 2020 10:51
将飞图网某页面下所有发布在百度云上的资源转存到百度云,并下载,解压再上传
#!/usr/bin/env python
#coding:utf-8
"""
download files from pan.baidu.com using https://github.com/PeterDing/iScript/blob/master/pan.baidu.com.py#pan.baidu.com.py
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
"""
@YieldNull
YieldNull / readme.md
Last active July 14, 2021 04:31
爬取新浪微博中指定用户所有相册图片,并保存到本地

功能

给定用户的ID(微相册的数字ID,非昵称),下载用户相册中所有图片到本地

所需模块

rsa,threadpool

登陆

请先更改login_weibo中的用户名及密码

用法

@YieldNull
YieldNull / CParser.jj
Created October 27, 2015 07:28
C grammar defintion for use with JavaCC.(Copied from https://java.net/downloads/javacc/contrib/grammars/C.jj)
/*
C grammar defintion for use with JavaCC
Contributed by Doug South (dsouth@squirrel.com.au) 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,