Skip to content

Instantly share code, notes, and snippets.

View reed-lau's full-sized avatar
🌴
Orz

reed reed-lau

🌴
Orz
View GitHub Profile
@reed-lau
reed-lau / SimpleHTTPServerWithUpload.py
Created August 18, 2020 06:48 — forked from UniIsland/SimpleHTTPServerWithUpload.py
Simple Python Http Server with Upload
#!/usr/bin/env python
"""Simple HTTP Server With Upload.
This module builds on BaseHTTPServer by implementing the standard GET
and HEAD requests in a fairly straightforward manner.
"""
@reed-lau
reed-lau / gil.c
Last active March 24, 2020 04:43
#define GET_TSTATE() \
((PyThreadState*)_Py_atomic_load_relaxed(&_PyThreadState_Current))
#define SET_TSTATE(value) \
_Py_atomic_store_relaxed(&_PyThreadState_Current, (Py_uintptr_t)(value))
PyThreadState *
PyThreadState_Swap(PyThreadState *newts)
{
PyThreadState *oldts = GET_TSTATE();
# mac vnc连接ubuntu
1 on ubuntu
sudo apt-get install x11vnc
x11vnc -storepasswd
x11vnc -forever -shared -rfbauth ~/.vnc/passwd
2 on mac
右键 访达-> 连接到 vnc://x.x.x.x:5900
@reed-lau
reed-lau / rw_spin_lock.h
Created November 28, 2018 02:43 — forked from yizhang82/rw_spin_lock.h
portable lock-free reader/writer lock for C++
class rw_spin_lock
{
public:
rw_spin_lock()
{
_readers = 0;
}
public:
void acquire_reader()
@reed-lau
reed-lau / Install etcd On Ubuntu 16.04.md
Created September 3, 2018 06:52 — forked from sanjid133/Install etcd On Ubuntu 16.04.md
Install etcd On Ubuntu 16.04
#!/bin/bash
curl -L https://github.com/coreos/etcd/releases/download/v3.3.1/etcd-v3.3.1-linux-amd64.tar.gz -o etcd-v3.3.1-linux-amd64.tar.gz
tar xzvf etcd-v3.3.1-linux-amd64.tar.gz
cd etcd-v3.3.1-linux-amd64
sudo cp etcd /usr/local/bin/
sudo cp etcdctl /usr/local/bin/
etcd --version