Skip to content

Instantly share code, notes, and snippets.

Being Spiderman

林玮 linw1995

Being Spiderman
Block or report user

Report or block linw1995

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
linw1995 /
Created Jul 18, 2019
用多线程加速爬虫做 lxml 解析 | 源码
import asyncio
import time
from concurrent.futures import ProcessPoolExecutor
from pathlib import Path
from lxml import html
_html_text = None
_latest_fetched = 0
linw1995 / kbd6x(hhkb).json
Last active Jul 15, 2019
KBD6x HHKB Config
View kbd6x(hhkb).json
"version": 1,
"keyboard": {
"keys": [
"id": 0,
"legend": "~\n`",
"state": {
"x": 0,
"y": 0,
View 在 Centos 6.8 中安装 Python

在 Centos 6.8 中安装 Python 3.7


yum install -y \
  zlib \
  zlib-devel \
  sqlite-devel \
  bzip2-devel \
linw1995 / aa_tree.c
Created Feb 12, 2019
AA Tree C implementation.
View aa_tree.c
#include <stdlib.h>
#define MIN(a, b) (a > b ? b : a)
struct TreeNode
int val;
struct TreeNode *left;
struct TreeNode *right;
linw1995 /
Last active May 29, 2019
Shadowsocks Lanuch Scripts
apt-get update
apt-get install -y python3-pip python3-setuptools python3-wheel
pip3 install -U shadowsocks
SS_MODULE_PATH=`python3 -c "import shadowsocks as m;print(m.__path__[0])"`
sed -i -e 's/EVP_CIPHER_CTX_cleanup/EVP_CIPHER_CTX_reset/g' $SS_MODULE_PATH/crypto/
cat > ss.json << EOF
linw1995 /
Last active Dec 28, 2018
Run Twisted in another thread
import socket
import threading
import pytest
from twisted.application import internet
from twisted.internet import reactor as twisted_reactor
from twisted.internet.protocol import Factory, Protocol
@pytest.fixture(scope="session", autouse=True)
linw1995 /
Last active Dec 12, 2018
run asyncio event loop in another thread.
import asyncio
import threading
class AsyncioBackground(threading.Thread):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.loop = asyncio.new_event_loop()
def run(self):
linw1995 /
Last active Apr 17, 2018
Install vim with Spacevim and python support.

Install vim with Spacevim and python support.

Install Python with shared libs.

using pyenv to install multi versions of python.

env PYTHON_CONFIGURE_OPTS="--enable-shared" pyenv install 3.6-dev
env PYTHON_CONFIGURE_OPTS="--enable-shared" pyenv install 2.7-dev
linw1995 /
Last active Feb 25, 2019
  1. 李金的 Python 笔记

    Python2.7版本的,不过2.7在2020年就不支持了。现在不是很推荐 可以看: 01. Python 工具 到 02. Python 基础

  2. Python 编程导论

    MIT 编程导论课的教材翻译版。这个旨在激发编程兴趣。 强烈推荐看完整本!!!

linw1995 /
Last active Mar 14, 2018
Python fake sleep fixture for pytest.
import functools
from datetime import datetime, timedelta
from unittest import mock
from freezegun import freeze_time
def fake_sleep(func):
freezegun_control = None
You can’t perform that action at this time.