Skip to content

Instantly share code, notes, and snippets.

@canhnt
canhnt / install-ingress.sh
Created August 15, 2018 19:02
Install ingress-nginx
kubectl create -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/master/deploy/mandatory.yaml
@canhnt
canhnt / clean-lv.sh
Last active August 14, 2018 07:23
Clean invalid LVs that exist in physical (via lvscan) but not managed by gluster
#!/usr/bin/env bash
# Find invalid LVs that exist in physical (via lvscan) but not managed by gluster
vgs=$1
host_address='10.165.210.xxx'
valid_lvs=$(gluster volume info | grep $vgs | grep ${host_address} | sed -e 's/.*brick_\(.[a-z0-9]*\)\/brick/\1/')
all_lvs=$(lvscan | grep $vgs | grep 'brick_' | awk -F'brick_' '{ print substr($2,0,32)}')
@canhnt
canhnt / aws-s3-upload.sh
Created July 9, 2018 09:20
Upload files to Minio server using AWS-CLI
export AWS_CA_BUNDLE=$path_private_ca_cert
aws --endpoint-url https://$minioserver s3 cp $filename s3://$bucketname
@canhnt
canhnt / gen-cert-k8s.sh
Created June 14, 2018 09:05
Create x509 cert for k8s
openssl req -new -key cngo.key -out cngo-csr.pem -subj "/CN=cngo/O=app1/O=infra-team"
openssl x509 -req -in cngo-csr.pem -CA ca.pem -CAkey ca-key.pem -CAcreateserial -out cngo.crt -days 730
@canhnt
canhnt / delete-evicted-pods.sh
Last active June 8, 2018 07:44
Delete all evicted pods
kubectl get pod --all-namespaces | grep Evicted | grep 10d | awk '{print $1" " $2}' | xargs -n2 sh -c 'kubectl delete pod $2 -n $1' sh
@canhnt
canhnt / git-delete-local-tag.sh
Created August 9, 2017 09:11
Delete local tags that do not exist in remote
git fetch --prune origin "+refs/tags/*:refs/tags/*"
@canhnt
canhnt / rsync-ssh.md
Last active April 24, 2018 18:46
rsync

Upload:

rsync -avH -P /home/localuser/testfile1 -e ssh bob@example.com:/target/file/path

Download

rsync -P --rsh=ssh bob@example.com:/path/to/source /localpath/to/dest

git config --global alias.lol 'log --graph --decorate --pretty=oneline --abbrev-commit --all'
@canhnt
canhnt / .bashrc-git.sh
Created February 3, 2016 14:02
Show current git branch in the command prompt
function parse_git_branch () {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
RED="\[\033[0;31m\]"
YELLOW="\[\033[0;33m\]"
GREEN="\[\033[0;32m\]"
NO_COLOR="\[\033[0m\]"
PS1="$GREEN\u@\h$NO_COLOR:\w$YELLOW\$(parse_git_branch)$NO_COLOR\$ "
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Repository
PUBLIC "-//The Apache Software Foundation//DTD Jackrabbit 2.6//EN"
"http://jackrabbit.apache.org/dtd/repository-2.6.dtd">
<Repository>
<DataSources>
<DataSource name="repositoryDS">