Skip to content

Instantly share code, notes, and snippets.

Being Spiderman

林玮 linw1995

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
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 Feb 26, 2019
Shadowsocks Lanuch Script On Vultr
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
linw1995 / Home-Q&
Last active Mar 20, 2018
Docker on win10
View Home-Q&

Window10 Home

  1. Volume - virtualbox guest additions
  2. Kitematic - must running as Admin. if not, it will cause the userdir\.docker\machine\machines\default\config.json missing, and break the VM.
linw1995 / Dockerfile
Created Feb 27, 2018
Google Chrome Headless Docker
View Dockerfile
FROM google/debian:jessie
ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update -qqy \
&& apt-get -qqy install \
gnupg wget ca-certificates apt-transport-https \
ttf-wqy-zenhei \
&& rm -rf /var/lib/apt/lists/* /var/cache/apt/*
You can’t perform that action at this time.