Skip to content

Instantly share code, notes, and snippets.

View s5unty's full-sized avatar

Sun Wuan s5unty

View GitHub Profile
@reachlin
reachlin / prometheus.yml
Created April 19, 2017 07:06
sample prometheus configuration explained
// For all the confusing Prometheus configuration and
// regular expressions,
// explained in examples.
// Remember, there are default values for each item if it's missing.
// regex is (.*),
// replacement is $1,
// separator is ;
// ,and action is replace
@edsiper
edsiper / kubernetes_commands.md
Last active May 6, 2024 08:53
Kubernetes Useful Commands
@akash1233
akash1233 / pre-receive.sh
Last active April 16, 2024 02:38
pre-receive git hooks for checking the commit message
#!/bin/bash
#
# check commit messages for pivotal tracker issue numbers formatted as [#stort-id]along with commit message
REGEX="\[#[0-9]*\]"
ERROR_MSG="[POLICY] The commit doesn't reference a PIVOTAL tracker issue"
while read OLDREV NEWREV REFNAME ; do
for COMMIT in `git rev-list $OLDREV..$NEWREV`;
do
MESSAGE=`git cat-file commit $COMMIT | sed '1,/^$/d'`
@napramirez
napramirez / ConvertLetsPemToPfx.sh
Created December 18, 2017 04:43
Convert LetsEncrypt Certificates to PFX
#!/bin/sh
#
# Copy of https://gist.githubusercontent.com/arichika/b1a1413b554734ae964f/raw/e657ad2dc4ddab60750d26e87add61f9b988d887/ConvertLetsPemToPfx.sh
#
pemsdir='/etc/letsencrypt/archive' # default search PEMs
pfxspath='/share/letsencrypt/archive' # dest of the PFXs
passfile='/share/letsencrypt/pass.txt' # password to be applied to the PFX file
for cnvifull in `find "${pemsdir}" -name 'cert*.pem' -o -name '*chain*.pem'`
@posener
posener / go-table-driven-tests-parallel.md
Last active April 30, 2024 20:34
Be Careful with Table Driven Tests and t.Parallel()

Be Careful with Table Driven Tests and t.Parallel()

We Gophers, love table-driven-tests, it makes our unittesting structured, and makes it easy to add different test cases with ease.

Let’s create our table driven test, for convenience, I chose to use t.Log as the test function. Notice that we don't have any assertion in this test, it is not needed to for the demonstration.

func TestTLog(t *testing.T) {
	t.Parallel()
@Oranzh
Oranzh / openssl.ssh
Created April 26, 2018 03:15 — forked from mbejda/openssl.ssh
Installing OpenSSL 1.0.2 on Ubuntu 14
openssl version -a
sudo add-apt-repository ppa:0k53d-karl-f830m/openssl
sudo apt-get update
sudo apt-get install openssl
openssl version -a
@mcattarinussi
mcattarinussi / gpg-ssh-setup.md
Last active May 22, 2024 13:24
A setup guide to use a personal gpg key for ssh authentication

GPG - SSH setup

Generating the master key

Here we create the master key. We want only Certify capability: we use the master key only to create the subkeys, Sign - Encrypt - Authenticate capabilities will be assigned to the subkeys.

Run the following command to start the master key generation process. Select the set your own capabilities creation process (type 8)

  ▶ gpg --full-generate-key --expert

gpg (GnuPG) 2.2.9; Copyright (C) 2018 Free Software Foundation, Inc.

@y0ngb1n
y0ngb1n / docker-registry-mirrors.md
Last active June 1, 2024 09:18
国内的 Docker Hub 镜像加速器,由国内教育机构与各大云服务商提供的镜像加速服务 | Dockerized 实践 https://github.com/y0ngb1n/dockerized

Docker Hub 镜像加速器

国内从 Docker Hub 拉取镜像有时会遇到困难,此时可以配置镜像加速器。Docker 官方和国内很多云服务商都提供了国内加速器服务。

Dockerized 实践 https://github.com/y0ngb1n/dockerized

配置加速地址

Ubuntu 16.04+、Debian 8+、CentOS 7+

@mayneyao
mayneyao / notion2blog.js
Last active February 29, 2024 18:01
Notion.so > Personal Blog | custom domain + disqus comment
const MY_DOMAIN = "agodrich.com"
const START_PAGE = "https://www.notion.so/gatsby-starter-notion-2c5e3d685aa341088d4cd8daca52fcc2"
const DISQUS_SHORTNAME = "agodrich"
addEventListener('fetch', event => {
event.respondWith(fetchAndApply(event.request))
})
const corsHeaders = {
"Access-Control-Allow-Origin": "*",
@fanlushuai
fanlushuai / surfingkeys-config.txt
Last active March 31, 2024 03:32
surfingkeys-config
//=========================enjoy !!!=============================================
// 1. 输入流畅理念。修改F键的导航功能,按键生成策略。采用左边前两排+v,b的字符。保证不会生成rx,一些让手指弯曲过度的组合按键。使得输入更加流畅
// 2. 高频快速直达理念。搜索,使用独立的s关键字,使用最少的按键,来处理最高频的功能。同理,最直达的逻辑优化。h,直达历史,以及内置的b书签。通过原始的o前缀虽然也挺快,但是,还是处在一种没有优先级的状态。
// 3. 添加快速搜索的能力(可以抛弃一键切换插件)(注:xx可以表达为,域名的缩写,比如,github-gh,google-gg。自己可以改配置,加搜索引擎):
// a. ";+xx",携带当前关键字,切换搜索引擎进行搜索】(独有扩展)
// b. ";;+xx", 使用当前选中的内容,进行浏览器的搜索(内置,使用s+。这种更加易于,减轻快捷键的记忆负担。)
// c. ";;;+xx", 使用用户输入,在当前页面打开输入框,进行搜索(内置,使用s+,这种减轻记忆负担。同时因为在使用频率上,也就s频率高。所以,单独抽取了一个s键)
// d. "alt+s",快速的自动切换搜索引擎,按照顺序进行搜索
// e. "oa+xx",使用关键字,同时打开相同类型的搜索引擎,进行搜索。比如,一个关键字将同时打开,google,baidu。
// 4. 添加导航的功能,使用"m+xx"的方式,直接跳转到目标网站(独有扩展。可以抛弃导航插件了)