Skip to content

Instantly share code, notes, and snippets.

View wppurking's full-sized avatar

wppurking wppurking

View GitHub Profile
@0neday
0neday / stunnel-aarch64.sh
Last active January 4, 2024 14:37
Cross compile statically stunnel for aarch64
### just for arm64
````
BASE=`pwd`
## cross-compile toolchain
git clone https://github.com/0neday/buildroot
cd buildroot
make menuconfig
### select aarch64 and enable ssp , c++ support
make -j$(nproc) toolchain
@dhh
dhh / Gemfile
Created June 24, 2020 22:23
HEY's Gemfile
ruby '2.7.1'
gem 'rails', github: 'rails/rails'
gem 'tzinfo-data', '>= 1.2016.7' # Don't rely on OSX/Linux timezone data
# Action Text
gem 'actiontext', github: 'basecamp/actiontext', ref: 'okra'
gem 'okra', github: 'basecamp/okra'
# Drivers
@doitian
doitian / rails-cookie-decrypt.go
Created September 23, 2017 07:30
rails session encrypt
@jokla
jokla / change_docker_root_folder.txt
Last active July 15, 2019 09:02
Change Docker root folder Ubuntu 14.04 and Ubuntu 16.04
$ sudo service docker stop
$ gksudo gedit /etc/default/docker
# Use DOCKER_OPTS to modify the daemon startup options.
DOCKER_OPTS="--dns 8.8.8.8 --dns 8.8.4.4 -g /home/jokla/docker/docker/"
$ sudo service docker start
UBUNTU 16.04

Scaling your API with rate limiters

The following are examples of the four types rate limiters discussed in the accompanying blog post. In the examples below I've used pseudocode-like Ruby, so if you're unfamiliar with Ruby you should be able to easily translate this approach to other languages. Complete examples in Ruby are also provided later in this gist.

In most cases you'll want all these examples to be classes, but I've used simple functions here to keep the code samples brief.

Request rate limiter

This uses a basic token bucket algorithm and relies on the fact that Redis scripts execute atomically. No other operations can run between fetching the count and writing the new count.

manual install

sudo curl -fsSL -o /tmp/install-flynn https://dl.flynn.io/install-flynn
sudo bash /tmp/install-flynn --channel nightly
sudo flynn-host init --init-discovery
sudo flynn-host init --discovery __token__
zpool create flynn-default /dev/sdb1
sudo service flynn-host start
sudo CLUSTER_DOMAIN=demo.localflynn.com flynn-host bootstrap --min-hosts 3 --discovery __token__
@choldrim
choldrim / gist:8f6d0c4e9a64910f4eda275f901b5031
Created July 10, 2016 03:52 — forked from xishuixixia/gist:95a15779c87bf4c74894
10个基于Docker的顶尖开发工具

随着Docker的发展,Docker的生态圈也越来越成熟,GitHub上出现了很多与Docker相关的开源项目。近日,CenturyLink在其博客上总结了基于Docker的10个开发工具,主要集中在PaaS平台、集群管理、持续集成和Docker的管理工具等四个方面。InfoQ中文站在其基础上进行了整理,具体如下。

  1. Flynn Flynn是一个使用Go语言编写的开源PaaS平台,Flynn使用模块化的设计,任何一个模块都可以独立的进行修改、升级和替换。Flynn的目标是简化分布式环境中应用的部署和维护,通过使用git push命令,Flynn就可以将应用部署到Docker,从而省去了复杂的配置和操作。Flynn的架构大致分为两层,Layer 0是底层的资源层,提供分布式配置、任务调度、服务发现、主机隔离等基础功能;Layer 1基于Layer 0构建了一个用于集群中管理、部署、扩展服务的系统,主要包括管理API/客户端、Git接收器、数据存储、路由。Flynn目前仍在开发中,尚未发布稳定版,但已经获得了很多公司的资助,它被称为是下一代的开源PaaS平台。

  2. Deis Deis也是一个支持共有云和私有云的开源PaaS系统,Deis基于Docker和CentOS构建了一个类Heroku的PaaS系统。Deis主要设计用来和不同的云提供商进行交互,目前支持 Rackspace、EC2、 DigitalOcean、Google Compute Engine、Bare-Metal。Deis使用out-of-the-box的方式支持Ruby、Python、Node.js、Java、Clojure、Scala、Play、PHP、Perl、Dart和Go语言,同样支持git push部署。Flynn和Deis都是两个基于Docker的云计算微PaaS技术,关于它们的区别,可以参考[这篇文章](http://www.centurylinklabs.com/flynn-vs-deis-the-tale-of-two-docker-micro-pa

@52cik
52cik / npm.taobao.sh
Last active February 29, 2024 02:56
npm 淘宝镜像配置
npm set registry https://r.npm.taobao.org # 注册模块镜像
npm set disturl https://npm.taobao.org/dist # node-gyp 编译依赖的 node 源码镜像
## 以下选择添加
npm set sass_binary_site https://npm.taobao.org/mirrors/node-sass # node-sass 二进制包镜像
npm set electron_mirror https://npm.taobao.org/mirrors/electron/ # electron 二进制包镜像
npm set ELECTRON_MIRROR https://cdn.npm.taobao.org/dist/electron/ # electron 二进制包镜像
npm set puppeteer_download_host https://npm.taobao.org/mirrors # puppeteer 二进制包镜像
npm set chromedriver_cdnurl https://npm.taobao.org/mirrors/chromedriver # chromedriver 二进制包镜像
npm set operadriver_cdnurl https://npm.taobao.org/mirrors/operadriver # operadriver 二进制包镜像
@ryerh
ryerh / tmux-cheatsheet.markdown
Last active April 18, 2024 18:06 — forked from MohamedAlaa/tmux-cheatsheet.markdown
Tmux 快捷键 & 速查表 & 简明教程

注意:本文内容适用于 Tmux 2.3 及以上的版本,但是绝大部分的特性低版本也都适用,鼠标支持、VI 模式、插件管理在低版本可能会与本文不兼容。

Tmux 快捷键 & 速查表 & 简明教程

启动新会话:

tmux [new -s 会话名 -n 窗口名]

恢复会话: