Skip to content

Instantly share code, notes, and snippets.

View linw1995's full-sized avatar

林玮 (Jade Lin) linw1995

View GitHub Profile
@linw1995
linw1995 / Dockerfile
Last active March 14, 2018 01:47
Using srs to build a simple flv.js Demo
FROM ubuntu:trusty
RUN apt-get update
RUN apt-get install git gcc g++ make libssl-dev python unzip -y
RUN git clone https://github.com/ossrs/srs.git /srs
RUN cd /srs && git checkout 3.0release
WORKDIR /srs/trunk
@linw1995
linw1995 / Dockerfile
Created February 27, 2018 06:33
Google Chrome Headless Docker
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/*
@linw1995
linw1995 / Home-Q&A.md
Last active March 20, 2018 09:03
Docker on win10

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
linw1995 / fake_sleep_decorator.py
Last active November 24, 2020 11:45
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
linw1995 / Python.md
Last active February 25, 2019 05:05
阅读清单
  1. 李金的 Python 笔记

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

  2. Python 编程导论

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

@linw1995
linw1995 / guide.md
Last active April 17, 2018 09:56
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
linw1995 / main.py
Last active December 12, 2018 06:27
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
linw1995 / test.py
Last active December 28, 2018 13:44
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
linw1995 / launch.ubuntu18.10x64.sh
Last active May 29, 2019 10:21
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/openssl.py
cat > ss.json << EOF
{