Skip to content

Instantly share code, notes, and snippets.

View taoyuan's full-sized avatar
:octocat:
I may be slow to respond.

TY taoyuan

:octocat:
I may be slow to respond.
View GitHub Profile
@taoyuan
taoyuan / enterprise_token.rb
Created November 15, 2022 05:19 — forked from markasoftware/enterprise_token.rb
OpenProject Enterprise mode for free
############ REPLACE app/models/enterprise_token.rb in the source code with this file! ################
############ also be sure to RESTART OpenProject after replacing the file. ################
############ it doesn't show that enterprise mode is enabled in the settings, but all ################
############ enterprise mode features, such as KanBan boards, are enabled. ################
#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) 2012-2020 the OpenProject GmbH
#
# This program is free software; you can redistribute it and/or
@taoyuan
taoyuan / generate_self_signed_certification.md
Last active May 10, 2024 11:02
Generation of a Self Signed Certificate

Generation of a Self Signed Certificate

Generation of a self-signed SSL certificate involves a simple 3-step procedure:

STEP 1: Create the server private key

openssl genrsa -out cert.key 2048

STEP 2: Create the certificate signing request (CSR)

openssl req -new -key cert.key -out cert.csr
@taoyuan
taoyuan / Clone-All-Repos-GitHub-Organization.md
Created June 24, 2020 06:03 — forked from nucliweb/Clone-All-Repos-GitHub-Organization.md
Clone all repos from a GitHub organization

Publics repos

With Ruby 1.8 (default version on MacOS) :

sudo gem install json
curl -s https://api.github.com/orgs/[ORGANIZATION]/repos | ruby -rubygems -e 'require “json”; JSON.load(STDIN.read).each {|repo| %x[git clone #{repo["ssh_url"]} ]}'

With Ruby 1.9+, the json library is by default thus you just use :

@taoyuan
taoyuan / git_config_proxy.sh
Last active March 13, 2020 12:25
git config proxy set and unset
# http proxy
git config --global https.proxy http://127.0.0.1:1088
git config --global https.proxy http://127.0.0.1:1088
# socks5 proxy
git config --global http.proxy socks5://127.0.0.1:1080
git config --global https.proxy socks5://127.0.0.1:1080
# unset proxy
git config --global --unset http.proxy
@taoyuan
taoyuan / rand.c
Created February 10, 2020 06:11
A linear congruential random generator
static uint32_t seed = 0;
static void srand32(uint32_t s) {
seed = s;
}
static uint32_t rand32(void) {
seed = (uint32_t)(((uint64_t)1664525 * seed) + 1013904223);
@taoyuan
taoyuan / privoxy_socks5_http_proxy.md
Last active November 28, 2019 02:03 — forked from alexniver/golang, ubuntu go get in china.md
ubuntu下, 使用 Privoxy 转换 socks5 到 http_proxy

#解决方案 Socks5 + Privoxy

思路就是, 建立一个本地sock5代理, 但因为go get 需要http代理, 所以需要使用privoxy把sock5代理转为http代理.

shadowsock

sudo apt-get install python-pip
@taoyuan
taoyuan / dumplib.sh
Created November 4, 2019 14:58
View the list of functions a Linux shared library is exporting
# On a MAC, use:
nm *.o | c++filt
@taoyuan
taoyuan / Makefile
Created October 28, 2018 15:47
Pack the nodejs application using `pkg`
# Pack the nodejs application using `pkg` (https://github.com/zeit/pkg)
# dependencies: rimraf, cpx and pkg
# > npm i rimraf cpx pkg -D
.PHONY: init clean build
OS := $(shell uname)
ARCH := $(shell uname -p)
all: dist
pushd /opt
sudo bash -c "wget https://github.com/sarfata/pi-blaster/archive/master.zip -O pi-blaster.zip"
sudo unzip pi-blaster.zip
if [ -d pi-blaster ]; then
sudo rm -fr pi-blaster
fi
sudo mv pi-blaster-master pi-blaster
cd pi-blaster
sudo ./autogen.sh
@taoyuan
taoyuan / WxTransport.js
Last active June 24, 2018 16:02
微信小程序蓝牙 Roal 适配器
class WxTransport extends roal.Transport {
constructor(options) {
super();
this._buf = [];
this._serviceUUID = options.serviceUUID;
this._characteristicUUID = options.characteristicUUID;
this._deviceId = null; // 扫描连接后,更新此字段
this.ready = this.setup();
}
setup() {