Run /usr/local/bin/k3s-uninstall.sh
This file contains hidden or 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
apiVersion: elasticsearch.k8s.elastic.co/v1beta1 | |
kind: Elasticsearch | |
metadata: | |
namespace: elastic-system | |
name: logging-eck | |
spec: | |
version: 7.4.2 | |
nodeSets: | |
- name: default | |
count: 1 |
This file contains hidden or 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
// QueryParams every key is a query param | |
type QueryParams map[string]QueryParam | |
// Scan satisfies SQL scanner interface | |
func (q *QueryParams) Scan(src interface{}) error { | |
b, ok := src.([]byte) | |
if !ok { | |
return errors.New("type assertion to []byte failed") | |
} |
This file contains hidden or 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
echo | openssl s_client -servername www.github.com -connect www.github.com:443 2>/dev/null | openssl x509 -noout -dates |
This file contains hidden or 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
// geoOffset 计算从 (lon0, lat0) 经纬度(单位 °)移动 dx, dy 米后的新的经纬度 | |
// | |
// 这个算法在100km以内有良好精度。 | |
// | |
// source: https://stackoverflow.com/questions/2839533/adding-distance-to-a-gps-coordinate | |
func geoOffset(lon0, lat0, dx, dy float64) (lon, lat float64) { | |
lon = lon0 + (180/math.Pi)*(dx/6378137)/math.Cos(lat0/180*math.Pi) | |
lat = lat0 + (180/math.Pi)*(dy/6378137) | |
return |
This file contains hidden or 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
#!/usr/bin/env bash | |
FOLDER=$1 | |
MAX_WIDTH=1400 | |
MAX_HEIGHT=1000 | |
# resize, strip metadata and save in a lower quality | |
# aspect ratio will be kept. | |
find ${FOLDER} \( -iname '*.jpg' -o -iname '*.jpeg' -o -iname '*.png' \) -exec convert \{} -verbose -strip -quality 75 -resize "${MAX_WIDTH}x${MAX_HEIGHT}>" \{} \; |
This file contains hidden or 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
func openBrowser(url string) { | |
var err error | |
switch runtime.GOOS { | |
case "linux": | |
err = exec.Command("xdg-open", url).Start() | |
case "windows": | |
err = exec.Command("rundll32", "url.dll,FileProtocolHandler", url).Start() | |
case "darwin": | |
err = exec.Command("open", url).Start() |
This file contains hidden or 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
#!/usr/bin/env bash | |
# preset veryslow: more time for more compressing rate | |
# -movflags +faststart optimizes for web browser so video can be played sooner. | |
# crf: small = better quality + bigger size; sane option between 17–28 | |
SRC="$1" | |
CRF="$2" | |
ffmpeg -i "$SRC" -vcodec libx264 -crf "$CRF" -movflags +faststart -preset veryslow -profile:v high -level 4.1 web_libx264_crf_${CRF}_faststart_veryslow.mp4 |
This file contains hidden or 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
FROM node:10.15 as builder | |
WORKDIR /project | |
COPY . . | |
RUN npm i && npm run lint && npm run build && rm -f dist/**/*.map | |
FROM nginx:stable | |
# COPY copies folder content, not folder itself | |
COPY --from=builder /project/dist /var/www | |
COPY ./nginx.conf /etc/nginx/conf.d/default.conf |
This file contains hidden or 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
FROM golang:1-alpine as golang | |
RUN apk --no-cache add git zip tzdata ca-certificates | |
# avoid go path, use go mod | |
WORKDIR /app | |
COPY . . | |
RUN CGO_ENABLED=0 go build -ldflags "-s -w -extldflags "-static"" ./cmd/appnamehere | |
WORKDIR /usr/share/zoneinfo | |
# -0 means no compression. Needed because go's | |
# tz loader doesn't handle compressed data. | |
RUN zip -r -0 /zoneinfo.zip . |