Skip to content

Instantly share code, notes, and snippets.

View movsb's full-sized avatar
☘️
Doing something interesting

桃子 movsb

☘️
Doing something interesting
View GitHub Profile
@movsb
movsb / main.cpp
Created March 10, 2017 17:10
在 C++ 中快速创建 LUA 自定义数据类型(带元表)的对象的一种包装方法
#include <cstdio>
#include <string>
#include <iostream>
#include <lua/lua.hpp>
#define LUAAPI(name) static int name(lua_State* L)
#define DECL_OBJECT(T) class T
@movsb
movsb / tunnel.go
Created December 6, 2019 14:50
An HTTP Tunnel Proxy, which implements the CONNECT method. Written in Golang, within 100 lines of code.
package main
import (
"io"
"log"
"net"
"net/http"
"sync"
)
@movsb
movsb / douban-movies-top250.go
Created May 9, 2020 16:30
A golang program to scrape [Douban Movie Top250](https://movie.douban.com/top250).
package main
import (
"fmt"
"io"
"net/http"
"os"
"strconv"
"strings"
@movsb
movsb / pbcopy
Created May 22, 2020 12:28
A MacOS pbcopy implementation for linux servers.
#!/bin/bash
set -euo pipefail
t=$(cat <&0 | base64 --wrap=0)
if [ ! -z ${STY+x} ]; then
echo -ne "\eP\e]52;c;$t\a\e\\"
elif [ ! -z ${TMUX+x} ]; then
echo -ne "\ePtmux;\e\e]52;c;$t\a\e\\"
else