Skip to content

Instantly share code, notes, and snippets.

View pplmx's full-sized avatar
💭
Thinking

Mystic pplmx

💭
Thinking
View GitHub Profile
@pplmx
pplmx / proxy.sh
Last active December 15, 2023 01:58
simplify some common proxy config
#!/bin/bash
# define color
RED='\033[0;31m'
GREEN='\033[0;32m'
NC='\033[0m' # No Color
function enable_proxy() {
git config --global http.proxy "$1"
git config --global https.proxy "$1"
@pplmx
pplmx / Makefile
Last active November 16, 2023 08:26
define a retry_command function in Makefile
# retry command with max retries and sleep time
# Notes: No Spaces between commas
# usage: $(call retry_command, command[,max_retries[,sleep_time]])
# example1: $(call retry_command, command -v jx,3,1s)
# example2: $(call retry_command, command -v jx)
# example3: $(call retry_command, command -v jx,3)
define retry_command
@max_retries=$(or $(2),10); \
sleep_time=$(or $(3),5s); \
retries=0; \
@pplmx
pplmx / scoop.md
Last active June 1, 2023 10:01
install some necessary packages for developer

scoop

install scoop

Set-ExecutionPolicy RemoteSigned -Scope CurrentUser
irm get.scoop.sh | iex

# You can use proxies if you have network trouble in accessing GitHub, e.g.
irm get.scoop.sh -Proxy 'http://' | iex
@pplmx
pplmx / Makefile
Last active September 4, 2023 02:27
Makefile help generator
.PHONY: help
.DEFAULT_GOAL := help
# Show help
help:
@echo ""
@echo "Usage:"
@echo " make [target]"
@echo ""
@echo "Targets:"
@pplmx
pplmx / Jenkinsfile
Last active April 10, 2023 08:21
Conventional Commit Check for Gerrit PatchSet
pipeline {
agent any
stages {
stage('Conventional Analysis') {
steps {
script {
echo "GERRIT_CHANGE_SUBJECT: ${GERRIT_CHANGE_SUBJECT}"
def changeSubj = "$GERRIT_CHANGE_SUBJECT".trim()
def match = (changeSubj =~ /^(build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test)(\([a-z]+\))?:\s.+$/)
if (!match) {
@pplmx
pplmx / docker.md
Last active April 27, 2023 03:28
Some docker useful commands

Docker CLi

docker image

  1. Update all images with local download tag
# 1. list images
# 2. split with the space, and filter out the first line, and the 2nd element is not "none", and finally combine the 1st and 2nd element
# 3. update the docker images and prune finally
docker image ls | \
@pplmx
pplmx / docker-compose.yml
Last active March 1, 2023 10:21
docker compose healthcheck
version: Compose specification
services:
proxy:
image: nginx
container_name: nginx
restart: always
ports:
- "8080:80"
healthcheck:
# 1. if curl or wget is not available, maybe try this
[base]
name=CentOS-vault-6.10 - Base - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos-vault/6.10/os/$basearch/
http://mirrors.aliyuncs.com/centos-vault/6.10/os/$basearch/
http://mirrors.cloud.aliyuncs.com/centos-vault/6.10/os/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos-vault/RPM-GPG-KEY-CentOS-6
#released updates
@pplmx
pplmx / config.json
Created October 28, 2022 08:35
Docker Registry Mirrors
"registry-mirrors":[
"https://hub-mirror.c.163.com/",
"https://docker.mirrors.ustc.edu.cn/",
"https://reg-mirror.qiniu.com/",
"https://registry.docker-cn.com",
"https://mirror.ccs.tencentyun.com"
]
@pplmx
pplmx / init.toml
Last active March 3, 2023 06:39
SpaceVim init.toml
#=============================================================================
# dark_powered.toml --- dark powered configuration example for SpaceVim
# Copyright (c) 2016-2022 Wang Shidong & Contributors
# Author: Wang Shidong < wsdjeg@outlook.com >
# URL: https://spacevim.org
# License: GPLv3
#=============================================================================
# All SpaceVim option below [option] section
[options]