Skip to content

Instantly share code, notes, and snippets.

@wavezhang
wavezhang / 合并相同单元格.vba
Created April 1, 2022 13:10
Excel 合并相同单元格
Sub 合并相同的单元格()
Dim ln%, a%, b%
Application.DisplayAlerts = False
ln = [A65536].End(xlUp).Row
For b = 1 To 5 Step 1
@wavezhang
wavezhang / mountraw
Last active February 4, 2022 08:20
#!/bin/bash
file=$1
part=$2
dest=$3
if [[ -z $part || -z $file || -z $dest ]];then
echo "usage $0 file part dest"
exit 1
fi
@wavezhang
wavezhang / change_pod_cidr.sh
Last active June 27, 2019 08:18
change k8s pod cidr without reconstruct cluster
#!/bin/bash
POD_CIDR="100.64.0.0\/14"
CTL_MGR_CFG=/etc/kubernetes/manifests/kube-controller-manager.yaml
kubectl apply -f https://docs.projectcalico.org/v3.1/getting-started/kubernetes/installation/hosted/calicoctl.yaml
echo "Updating kube controller manager params..."
sed -i "s/--cluster-cidr=.*/--cluster-cidr=$POD_CIDR/g" $CTL_MGR_CFG
@wavezhang
wavezhang / init.sh
Created May 17, 2018 14:23
init ssh key
yum install -y expect
chmod +x ssh-copy-id.exp
for i in `seq 12 25`; do
./ssh-copy-id 192.168.1.$i root 'password'
done
@wavezhang
wavezhang / restricted-psp.yaml
Created April 4, 2018 01:52 — forked from tallclair/restricted-psp.yaml
Restricted PodSecurityPolicy
apiVersion: extensions/v1beta1
kind: PodSecurityPolicy
metadata:
name: restricted
annotations:
seccomp.security.alpha.kubernetes.io/allowedProfileNames: 'docker/default'
apparmor.security.beta.kubernetes.io/allowedProfileNames: 'runtime/default'
seccomp.security.alpha.kubernetes.io/defaultProfileName: 'docker/default'
apparmor.security.beta.kubernetes.io/defaultProfileName: 'runtime/default'
spec:
@wavezhang
wavezhang / non_root_1024.sh
Created September 24, 2016 01:54
let non root user listen on port below 1024
setcap 'cap_net_bind_service=+ep' /usr/lib/jvm/jre/bin/java
@wavezhang
wavezhang / java_download.sh
Last active November 13, 2024 02:42
download java from oracle without login
wget -c --no-cookies --no-check-certificate --header "Cookie: oraclelicense=accept-securebackup-cookie" https://download.oracle.com/otn-pub/java/jdk/12.0.2+10/e482c34c86bd4bf8b56c0b35558996b9/jdk-12.0.2_linux-x64_bin.tar.gz
@wavezhang
wavezhang / sqlite2mysql.pl
Last active September 3, 2018 16:01
scripts to change sqlite3 db into mysql format
#! /usr/bin/perl
#
# based on https://stackoverflow.com/a/87531/5742651
# usage: sqlite3 .dump database_name.sqlite3 | perl sqlite2mysql.pl | mysql -u root -p $import_database_name
#
# ignore follow lines:
# BEGIN TRANSACTION
# COMMIT
# sqlite_sequence
# CREATE UNIQUE INDEX