This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
vue create PROJECT_NAME | |
# select features you need | |
cd PROJECT_NAME | |
vue add vue-next | |
rm src/shims-tsx.d.ts | |
sed -i '' 's/RouteConfig/RouteRecordRaw/g' src/router/index.ts # https://github.com/vuejs/vue-router-next/commit/fd49bbd085e9df7804994ea188f94384ac22e048 | |
patch -p1 <<'EOF' | |
diff --git a/src/components/HelloWorld.vue b/src/components/HelloWorld.vue | |
index dc773ba..01a7286 100644 | |
--- a/src/components/HelloWorld.vue |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cat > /etc/apt/sources.list.d/openjdk.list <<"EOF" | |
deb [check-valid-until=no] http://archive.debian.org/debian jessie-backports main | |
EOF | |
apt-get update | |
apt install -t jessie-backports openjdk-8-jdk | |
update-alternatives --config java # select java1.8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Credit: https://stackoverflow.com/a/59440771/398634 | |
TZ=UTC git --no-pager show \ | |
--quiet \ | |
--abbrev=12 \ | |
--date='format-local:%Y%m%d%H%M%S' \ | |
--format="%cd-%h" |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"bytes" | |
"context" | |
"golang.org/x/crypto/ssh" | |
"golang.org/x/crypto/ssh/agent" | |
"io/ioutil" | |
"net" | |
"os" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%{ | |
package main | |
import( | |
"fmt" | |
"bufio" | |
"os" | |
"strconv" | |
"unicode" | |
"unicode/utf8" | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Extract Node Exporter RPM package | |
# Download the official tar package | |
# https://prometheus.io/download/#node_exporter | |
VERSION=${VERSION:-0.18.1} | |
URL=https://github.com/prometheus/node_exporter/releases/download/v${VERSION}/node_exporter-${VERSION}.linux-amd64.tar.gz | |
FILENAME=${URL##*/} | |
ROOT_PATH=$PWD/pkg | |
APP_ROOT_PATH=$ROOT_PATH/opt/node_exporter | |
ITERATION=${ITERATION:-1} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Install docker and kubernetes first | |
# Helpful link: https://www.docker.com/products/docker-desktop | |
# Then you need to get into the virtual machine by (it may change in the future, but the path should be similar) | |
screen ~/Library/Containers/com.docker.docker/Data/vms/0/tty | |
# Change the line in /etc/kubernetes/manifests/kube-apiserver.yaml | |
# - --enable-admission-plugins=Initializers,NodeRestriction | |
# to | |
# - --enable-admission-plugins=Initializers,NodeRestriction,ValidatingAdmissionWebhook,MutatingAdmissionWebhook |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# cat simple_posthook.sh | |
#/usr/bin/bash | |
PUSHGATEWAY_SERVER=_YOUR_PUSHGATEWAY_SERVER_ADDRESS_WITH_PORT | |
JOB_NAME=_YOUR_JOB_NAME | |
while true; do | |
echo -e "HTTP/1.1 200 OK\n\n# $(date)" | nc -l 0.0.0.0 9092 &> /dev/null; | |
sleep 3; | |
curl -s "http://${PUSHGATEWAY_SERVER}/metrics" | sed -ne "s/push_time_seconds{instance=\"\([[:alnum:].]*\)\",job=\"${JOB_NAME}\".*/\1/p" | xargs -I INSNAME curl -X DELETE http://${PUSHGATEWAY_SERVER}/metrics/job/${JOB_NAME}/instance/INSNAME &> /dev/null; | |
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
cronjob_content = """ PAST YOUR CRONJOB HERE """ | |
cronjob_regex = re.compile(r'^([^#]\S*?) (\S+) (\S+) (\S+) (\S+)\s+(.+)$') | |
for n, (minute, hour, daymonth, month, dayweek, exp) in enumerate([i.groups() for i in map(cronjob_regex.search, d.splitlines()) if i], 1): | |
print "cronjob-%02d:" % n | |
print " cronjob.present:" | |
for k, v in {"minute": minute, "hour": hour, "daymonth": daymonth, "month": month, "dayweek": dayweek}.items(): | |
if v != "*": |