Skip to content

Instantly share code, notes, and snippets.

View 7error's full-sized avatar
🎯
Focusing

7error

🎯
Focusing
View GitHub Profile
@7error
7error / pull.sh
Created October 30, 2019 00:12
pull gcr images from gcr.azk8s.cn
ii="kube-apiserver:v1.16.2 kube-controller-manager:v1.16.2 kube-scheduler:v1.16.2 kube-proxy:v1.16.2 pause:3.1 etcd:3.3.15-0 coredns:1.6.2 metrics-server-amd64:v0.3.3"
for i in $ii; do
echo $i
docker image pull gcr.azk8s.cn/google_containers/$i;
docker image tag gcr.azk8s.cn/google_containers/$i k8s.gcr.io/$i;
docker image rmi gcr.azk8s.cn/google_containers/$i;
done
docker image list |grep gcr
@7error
7error / router.go
Created October 24, 2019 00:25 — forked from Hunsin/router.go
The package wraps julienschmidt's httprouter, making it support functions such as middlewares, sub/group routing with same prefix. Written in Go (Golang).
package router
import (
"net/http"
"github.com/julienschmidt/httprouter"
)
type middleware func(httprouter.Handle) httprouter.Handle
@7error
7error / check.sh
Last active October 28, 2019 03:54
check k8s network and port
pods=$(kubectl get pod -lapp=checknetwork -o jsonpath='{.items[*].metadata.name}') \
&& podips=$(kubectl get pod -lapp=checknetwork -o jsonpath='{.items[*].status.podIP}')
for pod in $pods; do
ip=$(kubectl get pod $pod -o jsonpath='{.status.podIP}')
for podip in $podips; do
if [ "$ip" == "$podip" ];
then
continue;
fi
export COREDNS_PODIP=$(kubectl get pod -o jsonpath={.items[0].status.podIP} -l k8s-app=kube-dns -n kube-system) \
&& kubectl run -it --rm --restart=Never --generator=run-pod/v1 \
--image=amouat/network-utils pod-$RANDOM \
--env="COREDNS_PODIP=$COREDNS_PODIP" \
-- /bin/sh -c 'sleep 3s; \
echo "################################################################" \
&& cat /etc/resolv.conf \
&& echo "################################################################" \
&& ip a \
&& echo "################################################################" \
[Unit]
Description=Caddy HTTP/2 web server
Documentation=https://caddyserver.com/docs
After=network-online.target
Wants=network-online.target systemd-networkd-wait-online.service
[Service]
Restart=on-abnormal
; User and group the process will run as.
@7error
7error / fastnetwork.sh
Created October 12, 2019 05:13 — forked from voyeg3r/fastnetwork.sh
fastast network config
#!/bin/bash
# Criado em:Qua 02/Jun/2010 hs 09:18
# Last Change: Qua 02/Jun/2010 hs 09:18
# vim:ft=sh:fdm=syntax:nu:
# Instituicao: none
# Proposito do script: agilizar configurações de rede
# Autor: Sérgio Luiz Araújo Silva
# site: http://vivaotux.blogspot.com
#net.core.rmem_max=8388608
@7error
7error / sysctl.conf
Created October 12, 2019 05:09 — forked from zas/sysctl.conf
sysctl
kernel.printk = 3 4 1 3
net.ipv4.tcp_syncookies = 1
net.ipv4.ip_forward = 1
net.ipv4.conf.all.arp_filter = 1
net.ipv4.conf.all.arp_ignore = 1
net.ipv4.ip_nonlocal_bind = 1
net.netfilter.nf_conntrack_max = 262144
net.netfilter.nf_conntrack_generic_timeout = 120
net.netfilter.nf_conntrack_tcp_timeout_close = 10
net.netfilter.nf_conntrack_tcp_timeout_close_wait = 60
@7error
7error / build-nginx.sh
Created October 11, 2019 04:44 — forked from niklasvincent/build-nginx.sh
Build script for statically compiled nginx 1.4.7 with OpenSSL 1.0.1e.
#!/bin/bash
set -e
NGINX_VERSION="1.6.0"
NGINX_TARBALL="nginx-${NGINX_VERSION}.tar.gz"
PCRE_VERSION="8.34"
PCRE_TARBALL="pcre-${PCRE_VERSION}.tar.gz"
OPENSSL_VERSION="1.0.1g"
OPENSSL_TARBALL="openssl-${OPENSSL_VERSION}.tar.gz"
#!/bin/bash
#Rotate the Nginx logs to prevent a single logfile from consuming too much disk space.
LOGS_PATH=/data/nginx/logs
YESTERDAY=$(date -d "yesterday" +%Y-%m-%d)
mv ${LOGS_PATH}/access.log ${LOGS_PATH}/access_${YESTERDAY}.log
mv ${LOGS_PATH}/error.log ${LOGS_PATH}/error_${YESTERDAY}.log
kill -USR1 `cat /data/nginx/logs/nginx.pid
./configure --prefix=/data/nginx \
--with-http_ssl_module \
--with-http_v2_module \
--with-http_stub_status_module \
--with-http_slice_module \
--with-compat \
--with-file-aio \
--with-threads \
--with-stream \