Skip to content

Instantly share code, notes, and snippets.

Wenzhi Liang wzhliang

View GitHub Profile
View foo.txt
# This file is generated from information provided by the datasource. Changes
# to it will not persist across an instance reboot. To disable cloud-init's
# network configuration capabilities, write a file
# /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with the following:
# network: {config: disabled}
network:
ethernets:
eth0:
addresses: ["10.0.2.12/16"]
gateway4: "10.0.0.1"
View gist:400ecb303f6f4fcf48709ffc7bba35ba
promtail_1 | level=info ts=2019–11–16T09:19:57.935528884Z caller=filetargetmanager.go:257 msg=”Adding target” key=”{env=\”dev\”, host=\”monitoring-dev\”, job=\”all-logs\”}”
promtail_1 | ts=2019–11–16T09:19:57.936230518Z caller=log.go:124 component=tailer level=info msg=”Seeked /var/log/dpkg.log — &{Offset:0 Whence:0}”
promtail_1 | level=info ts=2019–11–16T09:19:57.936292402Z caller=tailer.go:77 component=tailer msg=”start tailing file” path=/var/log/dpkg.log
View foo.json
[
{
"Ref": "docker.io/library/rust:1.42-slim-buster@sha256:1bf29985958d1436197c3b507e697fbf1ae99489ea69e59972a30654cdce70cb",
"Descriptor": {
"mediaType": "application/vnd.docker.distribution.manifest.v2+json",
"digest": "sha256:1bf29985958d1436197c3b507e697fbf1ae99489ea69e59972a30654cdce70cb",
"size": 742,
"platform": {
"architecture": "amd64",
"os": "linux"
View foo.dockerfile
FROM --platform=$BUILDPLATFORM debian:10 AS build
RUN apt-get update && \
apt-get install -y curl gcc make
RUN curl -o /cross.sh https://raw.githubusercontent.com/tonistiigi/binfmt/18c3d40ae2e3485e4de5b453e8460d6872b24d6b/binfmt/scripts/cross.sh && chmod +x /cross.sh
RUN curl https://ftp.gnu.org/gnu/hello/hello-2.10.tar.gz | tar xz
WORKDIR hello-2.10
ARG TARGETPLATFORM
RUN /cross.sh install gcc | sh
RUN LDFLAGS=-static \
./configure --host $(/cross.sh cross-prefix) && \
View gist:f864f9b1e659eb3694418081aa96df25
apiVersion: v1
clusters:
- cluster:
certificate-authority-data: <your cluster certificate-authority-data>
server: https://api.dev.automateops.co.uk
name: dev.automateops.co.uk
contexts:
- context:
cluster: dev.automateops.co.uk
user: google
View gist:5e10371fa31f657e8692343e3c548f42
"Descriptor": {
"mediaType": "application/vnd.docker.distribution.manifest.v2+json",
"digest": "sha256:bf284c4886f21a4a210a89c4b52d3a87bf90131479e5c78b63795b4d4f256415",
"size": 1571,
"platform": {
"architecture": "arm64",
"os": "linux"
}
},
View gist:ac3b1138be0b53af3a669b9e10af8e8a
CONNECTED(00000005)
depth=4 C = US, O = "Starfield Technologies, Inc.", OU = Starfield Class 2 Certification Authority
verify return:1
depth=3 C = US, ST = Arizona, L = Scottsdale, O = "Starfield Technologies, Inc.", CN = Starfield Services Root Certificate Authority - G2
verify return:1
depth=2 C = US, O = Amazon, CN = Amazon Root CA 1
verify return:1
depth=1 C = US, O = Amazon, OU = Server CA 1B, CN = Amazon
verify return:1
depth=0 CN = www.z.cn
View gist:8c4f3559b51bbfe6178d43c36cc04ac1
it('should handle feedback submission correctly', () => {
// navigate to testdriven.io
cy.visit('/');
cy.get('h1').contains('Test-Driven Development Courses');
// click feedback button
cy.get('button').contains('Feedback').click();
cy.get('#feedbackModal').should('have.css', 'display', 'block');
cy.get('h5').contains('Send Us Feedback');
cy.get('input[placeholder="Your email address"]').type('test@test.com');
cy.get('textarea').type('just a test');
View gist:3bab554a89866f1f381056f2df4ae523
proxy_cache_path /path/to/cache levels=1:2 keys_zone=my_cache:10m max_size=10g
inactive=60m use_temp_path=off;
server {
# ...
location / {
proxy_cache my_cache;
proxy_pass http://my_upstream;
}
}
@wzhliang
wzhliang / nginx_fallback
Created May 4, 2020
nginx fallback example
View nginx_fallback
server {
location / {
proxy_pass http://new_server;
error_page 404 500 502 503 504 = @fallback;
}
location @fallback {
proxy_pass http://old_server;
}
}
You can’t perform that action at this time.