Skip to content

Instantly share code, notes, and snippets.

View yujunz's full-sized avatar

Yujun Zhang yujunz

View GitHub Profile
@yujunz
yujunz / add-license.sh
Last active February 18, 2017 16:59
add license header for opnfv project
#!/bin/bash
# https://github.com/Justin-chi/Lab/blob/master/add_license.sh
TMP_FILE=tmp.file
LICENSE_TOKEN="http://www.apache.org/licenses/LICENSE-2.0"
function get_first_author()
{
author=$(git log --reverse --pretty=format:"%ae" $1 | head -1)
HOST_IFACE=$(ip route | grep "^default" | head -1 | awk '{ print $5 }')
LOCAL_IP=$(ip addr | awk "/inet/ && /${HOST_IFACE}/{sub(/\/.*$/,\"\",\$2); print \$2}")
cat << EOF | sudo tee -a /etc/hosts
${LOCAL_IP} $(hostname)
EOF
@yujunz
yujunz / bookinfo.istio.in
Created November 29, 2017 02:31
istio nginx frontend
server {
listen 80;
server_name bookinfo.istio;
location / {
proxy_pass http://${GATEWAY_URL};
proxy_http_version 1.1;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
@yujunz
yujunz / deployment.out.yaml
Created March 25, 2019 05:40
Deployment YAML out example
apiVersion: v1
kind: Pod
metadata:
annotations:
kubernetes.io/limit-ranger: 'LimitRanger plugin set: cpu request for container
nginx'
creationTimestamp: 2019-03-25T03:11:54Z
generateName: nginx-56f766d96f-
labels:
app: nginx
@yujunz
yujunz / Crash.log
Created August 20, 2019 13:42
terraform crash on `panic: not a string`
2019/08/20 21:38:29 [INFO] Terraform version: 0.12.6
2019/08/20 21:38:29 [INFO] Go runtime version: go1.12.7
2019/08/20 21:38:29 [INFO] CLI args: []string{"/usr/local/bin/terraform", "apply"}
2019/08/20 21:38:29 [DEBUG] Attempting to open CLI config file: /Users/yujunz/.terraformrc
2019/08/20 21:38:29 [DEBUG] File doesn't exist, but doesn't need to. Ignoring.
2019/08/20 21:38:29 [INFO] CLI command args: []string{"apply"}
2019/08/20 21:38:29 [TRACE] Meta.Backend: no config given or present on disk, so returning nil config
2019/08/20 21:38:29 [TRACE] Meta.Backend: backend has not previously been initialized in this working directory
2019/08/20 21:38:29 [DEBUG] New state was assigned lineage "e2697fca-0731-ee06-1703-c9f25bb0cb9b"
2019/08/20 21:38:29 [TRACE] Meta.Backend: using default local state only (no backend configuration, and no existing initialized backend)
@yujunz
yujunz / Time Machine On JuiceFS.md
Last active December 29, 2023 16:48
Time machine on JuiceFS
JFS_BASE=/Users/yujunz/JuiceFS
JFS_NAME=rogerz-s3-cn-east-1-qiniu
BUNDLE=TimeMachine.sparsebundle
VOLUME=/Volumes/TimeMachine

# Mount JuiceFS
juicefs mount --cache-dir $JUICEFS_BASE/cache --batch 10 --writeback --metacache --opencache $JFS_NAME $JFS_BASE/$JFS_NAME

# Create sparse bundle
@yujunz
yujunz / juicefs-csi-controller.md
Last active October 21, 2019 07:36
JuiceFS csi-v0 logs example

$ stern -n kube-system juicefs-csi-controller

juicefs-plugin I1021 06:37:52.136819       1 mount_linux.go:174 Cannot run systemd-run, assuming non-systemd OS
juicefs-plugin I1021 06:37:52.137071       1 mount_linux.go:175 systemd-run failed with: exit status 1
juicefs-plugin I1021 06:37:52.137110       1 mount_linux.go:176 systemd-run output: Failed to create bus connection: No such file or directory
juicefs-plugin I1021 06:37:52.137356       1 driver.go:112 Listening for connections on address: &net.UnixAddr{Name:"/var/lib/csi/sockets/pluginproxy/csi.sock", Net:"unix"}
csi-attacher I1021 06:38:09.108893       1 main.go:77 Version: v0.4.2-2-g2a08048
csi-attacher I1021 06:38:09.111942       1 connection.go:89 Connecting to /var/lib/csi/sockets/pluginproxy/csi.sock
csi-attacher I1021 06:38:09.112396       1 connection.go:116 Still trying, connection is CONNECTING
@yujunz
yujunz / pjdfstest-amazon-efs
Created December 14, 2019 04:44
pjdfstest on Amazon EFS
../pjdfstest/tests/chflags/00.t .......... ok
../pjdfstest/tests/chflags/01.t .......... ok
../pjdfstest/tests/chflags/02.t .......... ok
../pjdfstest/tests/chflags/03.t .......... ok
../pjdfstest/tests/chflags/04.t .......... ok
../pjdfstest/tests/chflags/05.t .......... ok
../pjdfstest/tests/chflags/06.t .......... ok
../pjdfstest/tests/chflags/07.t .......... ok
../pjdfstest/tests/chflags/08.t .......... ok
../pjdfstest/tests/chflags/09.t .......... ok
@yujunz
yujunz / pjdfstest-alicloud-nas-nfs4
Created December 15, 2019 08:51
pjdfstest on Alibaba Cloud NAS NFSv4
/root/pjdfstest/tests/chflags/00.t .......... ok
/root/pjdfstest/tests/chflags/01.t .......... ok
/root/pjdfstest/tests/chflags/02.t .......... ok
/root/pjdfstest/tests/chflags/03.t .......... ok
/root/pjdfstest/tests/chflags/04.t .......... ok
/root/pjdfstest/tests/chflags/05.t .......... ok
/root/pjdfstest/tests/chflags/06.t .......... ok
/root/pjdfstest/tests/chflags/07.t .......... ok
/root/pjdfstest/tests/chflags/08.t .......... ok
/root/pjdfstest/tests/chflags/09.t .......... ok
@yujunz
yujunz / pjdfstest-alicloud-nas-nfs3.log
Created December 15, 2019 08:58
pjdfstest on Alibaba Cloud NAS NFSv3
/root/pjdfstest/tests/chflags/00.t .......... ok
/root/pjdfstest/tests/chflags/01.t .......... ok
/root/pjdfstest/tests/chflags/02.t .......... ok
/root/pjdfstest/tests/chflags/03.t .......... ok
/root/pjdfstest/tests/chflags/04.t .......... ok
/root/pjdfstest/tests/chflags/05.t .......... ok
/root/pjdfstest/tests/chflags/06.t .......... ok
/root/pjdfstest/tests/chflags/07.t .......... ok
/root/pjdfstest/tests/chflags/08.t .......... ok
/root/pjdfstest/tests/chflags/09.t .......... ok