Skip to content

Instantly share code, notes, and snippets.

View alphajc's full-sized avatar
🎯
Focusing

Jerry Chan alphajc

🎯
Focusing
View GitHub Profile
---
apiVersion: v1
kind: ConfigMap
metadata:
name: filebeat-config
namespace: kube-system
labels:
k8s-app: filebeat
data:
filebeat.yml: |-
#!/usr/bin/env python
import sys
import pandas as pd
df = pd.read_csv(sys.argv[1])
last = ''
for row in df[df['Vpc名称'].notna()][df['主IPv4公网IP'].notna()].sort_values(by=['Vpc名称']).iterrows():
if last != row[1]['Vpc名称']:
#!/bin/bash
_APISERVER=127.0.0.1:10085
_V2CTL=/usr/bin/v2ray/v2ctl
apidata () {
local ARGS=
if [[ $1 == "reset" ]]; then
ARGS="reset: true"
fi
@alphajc
alphajc / gitlab-runner-args-vs-env.md
Created September 9, 2019 01:32
gitlab-runner配置参数与环境变量对照表

参数与环境变量对照表

参数 环境变量
-c value, --config value CONFIG_FILE
--template-config value TEMPLATE_CONFIG_FILE
--tag-list value RUNNER_TAG_LIST
-n, --non-interactive REGISTER_NON_INTERACTIVE
--leave-runner REGISTER_LEAVE_RUNNER
-r value, --registration-token value REGISTRATION_TOKEN
@alphajc
alphajc / gitlab-runner-admin.yml
Last active December 19, 2023 11:50
ERROR: Job failed (system failure): pods is forbidden: User "system:serviceaccount:gitlab:default" cannot create resource "pods" in API group "" in the namespace "gitlab"
# Source: gitlab-runner/templates/service-account.yaml
apiVersion: v1
kind: ServiceAccount
metadata:
name: default
namespace: gitlab
---
# Source: gitlab-runner/templates/role.yaml
apiVersion: rbac.authorization.k8s.io/v1
kind: "ClusterRole"
@alphajc
alphajc / Vagrantfile
Created July 18, 2019 01:15
Vagrant 启动集群
Vagrant.configure("2") do |config|
(1..3).each do |i|
config.vm.define "calico#{i}" do |node|
# 设置虚拟机的Box
node.vm.box = "ubuntu/bionic"
# 设置虚拟机的主机名
let obj = { 'A': 1, 'B.A': 2, 'B.B': 3, 'CC.D.E': 4, 'CC.D.F': 5}
function split(obj) {
for (let [key, value] of Object.entries(obj)) {
nks = key.split('.');
if (nks.length > 1) {
nk = nks.shift();
obj[nk] = obj[nk] || {};
obj[nk][nks.join('.')] = value;
delete obj[key];
@alphajc
alphajc / docker_desktop_get_k8s_images.sh
Last active July 12, 2019 23:43
桌面版 Docker 在国内想要不翻墙直接使用自带的 Kubenetes,必须先 pull 镜像,脚本如下
#!/bin/bash
set -e
KUBE_VERSION=v1.10.11
KUBE_PAUSE_VERSION=3.1
ETCD_VERSION=3.1.12
DNS_VERSION=1.14.8
DOCKER_TOOL_VERSION=v0.4.12
GCR_URL=k8s.gcr.io
@alphajc
alphajc / openssl.md
Last active January 3, 2018 06:09
有关openssl使用,详细的参数参见man手册

生成rsa key

openssl genrsa [-help] [-out filename] [-passout arg] [-aes128] [-aes192] [-aes256] [-camellia128] 
[-camellia192] [-camellia256] [-des] [-des3] [-idea] [-f4] [-3] [-rand file(s)] [-engine id] [numbits]

请求证书

#ctrl a
set -g prefix ^a
unbind ^b
bind a send-prefix
#此类配置可以在命令行模式中输入show-options -g查询
#set-option -g base-index 1 #窗口的初始序号;默认为0,这里设置为1
set-option -g display-time 5000 #提示信息的持续时间;设置足够的时间以避免看不清提示,单位为毫秒
set-option -g repeat-time 1000 #控制台激活后的持续时间;设置合适的时间以避免每次操作都要先激活控制台,单位为毫秒
set-option -g status-keys vi #操作状态栏时的默认键盘布局;可以设置为vi或emacs
#set-option -g status-right "#(date +%H:%M' ')" #状态栏右方的内容;这里的设置将得到类似23:59的显示