Skip to content

Instantly share code, notes, and snippets.

View xuyuji9000's full-sized avatar

Karl Xu xuyuji9000

  • Shanghai, China
View GitHub Profile
# This shell file used for practice the learning from the following link:
# - https://blog.dnmfarrell.com/post/bash-function-names-can-be-almost-anything/
function ++ { (( $1++ )); }
a=1
++ a
echo $a
@xuyuji9000
xuyuji9000 / ec2-ftp-tutorial.md
Created October 23, 2018 12:17 — forked from tylermakin/ec2-ftp-tutorial.md
Tutorial for configuring FTP access to an EC2 server
def coroutine(text):
while True:
input_search = (yield)
if input_search in text:
print 'contained'
else:
print('no')
@xuyuji9000
xuyuji9000 / automation-template.sh
Created November 28, 2017 11:04
This is the template for project automation.
#!/bin/sh
White='\033[1;36m'
NC='\033[0m' # No Color
case "$1" in
"test" )
docker run --rm -it -v "$PWD":/app -w /app node:carbon-alpine /bin/sh -c "npm run test";;
* )
echo "${White}test${NC}: run node test in docker"
@xuyuji9000
xuyuji9000 / test-nginx-proxy-with-ssl.yml
Created November 19, 2017 13:53
File name should be docker-compose.yml.
version: '2'
services:
nginx-proxy:
image: jwilder/nginx-proxy
ports:
- "80:80"
- "443:443"
volumes:
@xuyuji9000
xuyuji9000 / test-nginx-proxy.yml
Created November 19, 2017 13:15
File name should be docker-compose.yml
version: '2'
services:
nginx-proxy:
image: jwilder/nginx-proxy
ports:
- "80:80"
volumes:
- /var/run/docker.sock:/tmp/docker.sock:ro
grant all privileges on *.* to 'root'@'%' identified by 'xuyuji';
flush privileges;
#!/bin/bash
apt update && apt install ebtables ethtool -y
apt update && apt-get install -y apt-transport-https
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -
cat <<EOF >/etc/apt/sources.list.d/kubernetes.list
deb http://apt.kubernetes.io/ kubernetes-xenial main
EOF
apt update && apt install -y kubelet kubeadm kubectl
#!/bin/bash
# install docker
apt update
apt install \
apt-transport-https \
ca-certificates \
curl \
software-properties-common -y
INSERT INTO users (name) VALUES ('Karl');