Skip to content

Instantly share code, notes, and snippets.

View gavinzhou's full-sized avatar
🏠
Working from home

Gavin Zhou gavinzhou

🏠
Working from home
View GitHub Profile
@gavinzhou
gavinzhou / playbook-to-migrate-to-imdsv2.yml
Created April 11, 2024 09:42 — forked from suneshgovind/playbook-to-migrate-to-imdsv2.yml
Ansible playbook to automate migration of AWS EC2 instances to Instance Metadata Service version 2 (IMDSv2)
---
- name: To enable IMDSv2 in AWS EC2 instances
hosts: localhost
vars:
regions: ["eu-north-1", "ap-south-1", "eu-west-3", "eu-west-2", "eu-west-1", "ap-northeast-2", "ap-northeast-1", "sa-east-1", "ca-central-1", "ap-southeast-1", "ap-southeast-2", "eu-central-1", "us-east-1", "us-east-2", "us-west-1", "us-west-2"]
shell_file: "modify_instance_metadata_options.sh"
tasks:
- name: get instance info
local_action:
@gavinzhou
gavinzhou / s3get.sh
Created September 29, 2018 03:05 — forked from jpillora/s3get.sh
S3 signed GET in plain bash (Requires openssl and curl)
#!/bin/bash
#set these in your environment/profile (NOT HERE)
AWS_ACCESS_KEY=""
AWS_SECRET_KEY=""
function s3get {
#helper functions
function fail { echo "$1" > /dev/stderr; exit 1; }
#dependency check
@gavinzhou
gavinzhou / medium2md.go
Created August 3, 2018 03:39 — forked from clipperhouse/medium2md.go
A Go script to convert Medium export (HTML) to Markdown, for use with Hugo. It’s a one-use type of thing for me, so it ain’t beautiful.
// A quick script for converting Medium HTML files to Markdown, suitable for use in a static file generator such as Hugo or Jekyll
package main
import (
"fmt"
"io/ioutil"
"log"
"os"
"path/filepath"
"regexp"
@gavinzhou
gavinzhou / WORKSPACE
Created November 8, 2017 15:05 — forked from PyYoshi/WORKSPACE
bazel build docker-alpinelinux 3.5
# AlpineLinux 3.5
new_http_archive(
name = "docker_alpinelinux",
url = "https://nl.alpinelinux.org/alpine/v3.5/releases/x86_64/alpine-minirootfs-3.5.1-x86_64.tar.gz",
build_file = "alpinelinux.BUILD",
sha256 = "fa17f25ded0b29d94d8cc2d9aabb6f737f4b987c42fe8a6d11e05cfe2c52a64c",
)
@gavinzhou
gavinzhou / kube-status.log
Created December 18, 2016 01:12 — forked from theobolo/kube-status.log
IngressController
Test
@gavinzhou
gavinzhou / grafana custom.ini
Created December 16, 2016 04:21 — forked from mvadu/grafana custom.ini
nginx config for using grafana, Influxdb via reverse proxy with authentication
# The full public facing url
#root_url = %(protocol)s://%(domain)s:%(http_port)s/
root_url = http://localhost:80/grafana/
@gavinzhou
gavinzhou / .noserc
Created December 9, 2016 02:20 — forked from SpainTrain/.noserc
Relevant config files for a python GAE app using CircleCI
[nosetests]
verbosity=3
with-coverage=1
cover-branches=1
cover-xml=1
cover-xml-file=./coverage.xml
cover-min-percentage=66
with-profile=1
@gavinzhou
gavinzhou / bash.generate.random.alphanumeric.string.sh
Created October 18, 2016 01:45 — forked from earthgecko/bash.generate.random.alphanumeric.string.sh
shell/bash generate random alphanumeric string
#!/bin/bash
# bash generate random alphanumeric string
#
# bash generate random 32 character alphanumeric string (upper and lowercase) and
NEW_UUID=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)
# bash generate random 32 character alphanumeric string (lowercase only)
cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1
@gavinzhou
gavinzhou / influxdb.conf
Created September 20, 2016 04:51 — forked from acherunilam/influxdb.conf
Nginx config for InfluxDB HA
http {
client_max_body_size 20M;
upstream influxdb {
server server1:8086;
server server2:8086;
}
upstream relay {
server server1:9096;
server server2:9096;
@gavinzhou
gavinzhou / README.md
Created September 15, 2016 04:58 — forked from rowanmanning/README.md
Writing a Friendly README. This a companion-gist to the post: http://rowanmanning.com/posts/writing-a-friendly-readme/