Skip to content

Instantly share code, notes, and snippets.

View ciiiii's full-sized avatar
🌏
UTC+8

Yisheng Cai ciiiii

🌏
UTC+8
View GitHub Profile
@pidb
pidb / better-clean-slice-for-go-compiler.go
Created September 23, 2021 01:45
Better clean slice for go compiler
package main
type items []int
var nilItems = make(items, 16)
func (s *items) truncate1(i int) {
*s = (*s)[:i]
}
DOMAIN-SUFFIX,ts.shoujo.network
DOMAIN-SUFFIX,beta.tailscale.net
DOMAIN-SUFFIX,dev1.me
IP-CIDR,100.64.0.0/10
@bcnzer
bcnzer / worker.js
Created October 15, 2018 09:31
Cloudflare Worker that uses Workers KV to get Authorization data. All authentication and authorization is done on the edge
addEventListener('fetch', event => {
event.respondWith(handleRequest(event))
})
/**
* Entry point of the worker
*/
async function handleRequest(event) {
try {
// Get the JWT
@sdkks
sdkks / README.md
Last active March 5, 2024 06:17
How to SSH to Kubernetes Pod with SSH ProxyCommand using socat

Requirements

  1. socat
  2. kubectl with proper ~/.kube/config that can connect to your cluster
  3. Working knowledge of kubectl client
  4. OpenSSH client

How does it work?

  1. kubectl does port forwarding to sshd port of your pod. I'm using pm2 process managed to keep my services alive in my workstation container. If you have only sshd, easiest to use is dropbear
  2. ProxyCommand of OpenSSH client uses socat to redirect two way fd - to forwarded port of kubectl
  3. Voila! You are in
@xiaostrong
xiaostrong / qqmessage.py
Created February 21, 2018 08:57
QQ空间留言脚本
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import requests
import time
import re
import json
import time
def login():
options = webdriver.ChromeOptions()
@ciiiii
ciiiii / docker-compose.yml
Last active February 3, 2018 11:55
posgresql(healthcheck) docker-compose
version: '2.1'
services:
postgres:
# image: sameersbn/postgresql:9.6-2
image: healthcheck/postgres
ports:
- "5432:5432"
environment:
- POSTGRES_DB=pgname
- POSTGRES_USER=pguser
@troyfontaine
troyfontaine / 1-setup.md
Last active April 24, 2024 14:19
Signing your Git Commits on MacOS

Methods of Signing Git Commits on MacOS

Last updated March 13, 2024

This Gist explains how to sign commits using gpg in a step-by-step fashion. Previously, krypt.co was heavily mentioned, but I've only recently learned they were acquired by Akamai and no longer update their previous free products. Those mentions have been removed.

Additionally, 1Password now supports signing Git commits with SSH keys and makes it pretty easy-plus you can easily configure Git Tower to use it for both signing and ssh.

For using a GUI-based GIT tool such as Tower or Github Desktop, follow the steps here for signing your commits with GPG.

@gboudreau
gboudreau / AuthyToOtherAuthenticator.md
Last active April 26, 2024 16:33 — forked from Ingramz/AuthyToOtherAuthenticator.md
Export TOTP tokens from Authy
@egmontkob
egmontkob / Hyperlinks_in_Terminal_Emulators.md
Last active April 25, 2024 15:17
Hyperlinks in Terminal Emulators
@doubleyou
doubleyou / Makefile
Last active August 15, 2023 10:30
grpc-gateway python example
GATEWAY_FLAGS := -I. -I/usr/local/include -I$(GOPATH)/src/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis -I/usr/local/include
GRPC_FLAGS := --python_out=. --grpc_python_out=.
code:
python -m grpc_tools.protoc $(GRPC_FLAGS) $(GATEWAY_FLAGS) *.proto
gw:
protoc $(GATEWAY_FLAGS) \
--go_out=Mgoogle/api/annotations.proto=github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis/google/api,plugins=grpc:. \