Skip to content

Instantly share code, notes, and snippets.


K8sCat k8scat

View GitHub Profile
k8scat /
Last active Apr 21, 2022
Sync user home between two remote servers.
# server1 and server2 are defined in ~/.ssh/config
users=$(ssh server1 "ls /home")
for user in ${users}; do
user_home_found=$(ssh server2 "ls /home" | grep "${user}")
if [[ -n "${user_home_found}" ]]; then
echo "user home already created: ${user}"
k8scat / github.js
Last active Feb 24, 2022 — forked from ye11ow/github.js
Add a "Copy link" button to Github issue and pull requests
View github.js
// ==UserScript==
// @name Copy Link for GitHub Issues and PRs
// @namespace
// @version 0.2
// @description Add a "Copy link" button to Github issue and pull requests
// @author ye11ow, K8sCat <>
// @match*
// @include*/issues/*
// @include*/pull/*
// @icon
k8scat / gist:213820c0204f452d5c67295c406b78fd
Created Jan 9, 2022 — forked from cdown/gist:1163649
Bash urlencode and urldecode
View gist:213820c0204f452d5c67295c406b78fd
urlencode() {
# urlencode <string>
local length="${#1}"
for (( i = 0; i < length; i++ )); do
local c="${1:$i:1}"
case $c in
k8scat /
Created Dec 4, 2021
华为4G无线路由器2 Pro 自动修改密码
import random
import string
import time
from selenium import webdriver
from import WebDriver
from import By
from selenium.webdriver.remote.webelement import WebElement
k8scat /
Created Dec 3, 2021
自动清理 harbor 镜像
use std::collections::HashMap;
use std::ops::Sub;
use std::str::FromStr;
use chrono::Duration;
use chrono::prelude::*;
use reqwest::header::{HeaderMap, HeaderName, HeaderValue};
extern crate base64;
const HARBOR_BASE_API: &str = "";
View gist:a8744512b5e78cb7cf4e621476cdb75f
### Keybase proof
I hereby claim:
* I am k8scat on github.
* I am k8scat ( on keybase.
* I have a public key whose fingerprint is 9136 F38B 2DC8 7ABB 204B D0D6 CFB6 A936 4A3D 8FF5
To claim this, I am signing this object:
k8scat /
Last active Aug 21, 2021
Batch Unprotect GitLab protected_branches via python
import requests
import json
import logging
class GitLab:
token = ''
auth_headers = None
base_api = ''
client = None
# centos: cd /usr/share/git-core/templates/
git config --global init.templatedir '~/.git_template'
# Delete local tags
git tag -l | xargs git tag -d && git fetch origin
# Prune local branches
git fetch origin --prune -q
# Prune local branches/tags
git fetch origin --prune --prune-tags -q
k8scat /
Last active Jul 30, 2021
Install OpenResty on Ubuntu from source code.
set -e
rm -rf openresty- openresty-
apt-get update -y
apt-get install -y libpcre3-dev \
libssl-dev \
perl \
make \
build-essential \