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
$ curl http://127.0.0.1:8080/apis/batch/v1
{
"kind": "APIResourceList",
"apiVersion": "v1",
"groupVersion": "batch/v1",
"resources": [
{
"name": "jobs",
"namespaced": true,
"kind": "Job"
@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"
// CheckEndOfMonth check end of month
func CheckEndOfMonth() bool {
return time.Now().Add(+24*time.Hour).Day() == 1
}
import boto3
import time
from botocore.client import ClientError
from datetime import datetime, timedelta, tzinfo
ec2 = boto3.client('ec2')
instances = ["i-xxxx1","i-xxxx4"]
image_prefix = "automatic_creation_"
apt update -qq
g++
export PROTOBUF_VERSION=3.5.1
apt install unzip -y
mkdir ~/temp && cd ~/temp && wget "https://github.com/google/protobuf/releases/download/v$PROTOBUF_VERSION/protoc-$PROTOBUF_VERSION-linux-x86_64.zip" && unzip protoc-$PROTOBUF_VERSION-linux-x86_64.zip && mv include/* /usr/local/include/ && mv bin/* /usr/local/bin/ && cd ~/ && rm -rf ~/temp
apt install wget -qq
cd ..
rm -rvf temp
mkdir ~/temp && cd ~/temp && wget "https://github.com/google/protobuf/releases/download/v$PROTOBUF_VERSION/protoc-$PROTOBUF_VERSION-linux-x86_64.zip" && unzip protoc-$PROTOBUF_VERSION-linux-x86_64.zip && mv include/* /usr/local/include/ && mv bin/* /usr/local/bin/ && cd ~/ && rm -rf ~/temp
go
module.exports = {
username: '<username>',
password: '<password>'
};
const fs = require('fs');
const puppeteer = require('puppeteer');
const speedline = require('speedline');
const USERNAME_SELECTOR = 'body > grafana-app > div.main-view > div > div:nth-child(1) > div > div > div.login-inner-box > form > div:nth-child(1) > input';
const PASSWORD_SELECTOR = '#inputPassword';
const CLICK_BUTTON = 'body > grafana-app > div.main-view > div > div:nth-child(1) > div > div > div.login-inner-box > form > div.login-button-group > button';
const CREDS = require('./creds');
@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 / github-release.sh
Created June 18, 2017 05:30
github release script
#!/bin/sh
set -xe
RUBY_VERSION=$(grep "%define \+rubyver" $HOME/$CIRCLE_PROJECT_REPONAME/ruby.spec | awk '{print $3}')
need_to_release() {
http_code=$(curl -sL -w "%{http_code}\\n" https://github.com/${CIRCLE_PROJECT_USERNAME}/${CIRCLE_PROJECT_REPONAME}/releases/tag/${RUBY_VERSION} -o /dev/null)
test $http_code = "404"
}
#!/bin/bash
# Install Wavefront Proxy and configures standard telegraf plugin
# ####
function logo() {
cat << "EOT"
__ __ _____ __
/ \ / \_____ ___ __ _____/ ____\______ ____ _____/ |_
\ \/\/ /\__ \\ \/ // __ \ __\\_ __ \/ _ \ / \ __\
\ / / __ \\ /\ ___/| | | | \( <_> ) | \ |