Skip to content

Instantly share code, notes, and snippets.

View able8's full-sized avatar

Able Lv able8

View GitHub Profile
@able8
able8 / test.md
Last active April 27, 2024 15:08
1test
@able8
able8 / vault-scanner.go
Created April 27, 2024 15:05
Search / Download Retrieve all secrets from HashiCorp's Vault in Golang
package main
import (
"encoding/json"
"fmt"
"io"
"log"
"net/http"
"os"
"path"
@able8
able8 / vimium-options.json
Created March 18, 2024 06:08
My vimium configs
{
"keyMappings": "# Insert your preferred key mappings here.\nunmap d\nmap d scrollFullPageDown\nmap <down> scrollFullPageDown\nmap e scrollFullPageUp\nmap <up> scrollUp\n#map e scrollPageUp\nmap w nextTab\nmap a previousTab\n\nunmap l\nmap s goBack\nmap l goForward\n\nmap z restoreTab\nmap c goNext\nmap h goPrevious\n\nunmap f\nunmap F\n\n\nmap F LinkHints.activateModeToOpenInNewForegroundTab\nmap f LinkHints.activateModeToOpenInNewTab\nmap o Vomnibar.activateInNewTab\nmap q visitPreviousTab\n\n# map t createTab http://www.google.com/\n#map t createTab https://www.deepl.com/write\nmap t duplicateTab\n\nmap  ; Marks.activateGotoMode swap\nmap m Marks.activateCreateMode swap\n\nmap <c-,> moveTabLeft count=99\nmap <c-.> moveTabRight count=99\n\nmap <c-f> LinkHints.activateModeWithQueue\n\nunmap p\nmap p openCopiedUrlInNewTab\n\nmap <c-p> togglePinTab\nmap <c-d> LinkHints.activateModeToDownloadLink\n\nunmap b\nmap b Vomnibar.activateTabSelection",
"linkHintCharacters": "asdfwerzxcv",
"nextPatterns": "下一篇,
#!/bin/bash
# ------------------------------------------------------------------------------
# 您好!本脚本纯shell编写,用于收集系统日志以及相关服务日志等,
#
# 目前兼容TKE的Ubuntu、Centos,脚本开源,您可以直接用vim打开脚本查阅里面的代码。
#
# 确认脚本无误后,放到容器节点运行。成功后,请把/tmp/tkelog/tkelog.tar.gz打包文件发我们进行问题排查,感谢您的支持!
# ------------------------------------------------------------------------------
export PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin/bash
version='2020.1'
@able8
able8 / main.go
Created November 1, 2023 15:01
Get Node and Pod Resource Usages using K8s metricsClient
package main
// https://cloud.tencent.com/developer/ask/sof/115441746
import (
"bytes"
"context"
"flag"
"fmt"
"log"
@able8
able8 / Export Notes.AppleScript
Created May 16, 2017 08:34
Export Apple Notes via AppleScript
tell application "TextEdit"
activate
make new document
end tell
tell application "Notes"
if folder "Archive" exists then
set output to ""
repeat with aNote in notes in folder "Archive"
@able8
able8 / you-get-retry.sh
Last active April 2, 2023 03:42
下载出错,就重新执行下载。在bilibili下载时,经常会出错下载中断,需要重新运行命令才行。该脚本可以自动重试下载,直到下载完成后结束。
#!/bin/bash
url='https://www.bilibili.com/video/av17981530'
# 一行写法
while true; do you-get $url && { echo ok完成; break; } || { echo err出错,重试; sleep 5; }; done
while true; do you-get $url --playlist && { echo ok完成; break; } || { echo err出错,重试; sleep 5; }; done
// Watch Pod update events
podInformer.Informer().AddEventHandler(cache.ResourceEventHandlerFuncs{
UpdateFunc: func(old interface{}, new interface{}) {
oldPod, newPod := old.(*v1.Pod), new.(*v1.Pod)
oldPodRestartCount := getPodRestartCount(oldPod)
newPodRestartCount := getPodRestartCount(newPod)
// Compare the RestartCount
if newPodRestartCount > oldPodRestartCount {
key, err := cache.MetaNamespaceKeyFunc(new)
if err == nil {
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
kubectl.kubernetes.io/last-applied-configuration: |
{"apiVersion":"apiextensions.k8s.io/v1","kind":"CustomResourceDefinition","metadata":{"annotations":{},"name":"serviceboards.airwallex.com"},"spec":{"group":"airwallex.com","names":{"kind":"ServiceBoard","plural":"serviceboards","shortNames":["svcb"],"singular":"serviceboard"},"scope":"Namespaced","versions":[{"additionalPrinterColumns":[{"jsonPath":".spec.serviceInfomation.pods.status.ready","name":"Ready","type":"string"},{"jsonPath":".spec.serviceInfomation.pods.imageTags","name":"ImageTags","type":"string"},{"jsonPath":".spec.serviceInfomation.ingress.hosts","name":"IngressHosts","type":"string"},{"jsonPath":".spec.serviceInfomation.updatedAt","name":"UpdatedAt","type":"date"}],"name":"v1alpha1","schema":{"openAPIV3Schema":{"properties":{"spec":{"properties":{"serviceInfomation":{"properties":{"clusterName":{"type":"string"},"ingress":{"properties":{"hos
@able8
able8 / check-key-expiration.sh
Created May 27, 2022 03:28
check SSL certificate and PGP key expiration date with shell
#!/bin/bash
# check TLS/SSL certificate expiration date
# openssl x509 -text -noout -in inputfile
# https://www.sslshopper.com/certificate-decoder.html
echo -e "\n## SSL Certificates List: \n\n| File Name | Valid From | Valid To | Comment |\n| --- | --- | --- | --- |" >> README.md
for file in $(find .); do
if test -f $file; then
if grep -q "\-BEGIN CERTIFICATE\-" $file; then