Skip to content

Instantly share code, notes, and snippets.

@mashenjun
mashenjun / benchmark-ec2-boottime.sh
Created December 13, 2015 16:29 — forked from andsens/benchmark-ec2-boottime.sh
Starts a single instance and measures the time until SSH connectivity
#!/bin/bash -e
# These need to be set.
#export EC2_HOME="/path/to/ec2-api-tools"
#export AWS_ACCESS_KEY='XXXXXXXXXXXXXXXXXXXX'
#export AWS_SECRET_KEY='XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
#export PATH="$PATH:${EC2_HOME}/bin"
ami_id='ami-123abc12'
availability_zone='eu-west-1a'
keypair="johndoe@example.com"
@mashenjun
mashenjun / .travis.yml
Created November 20, 2017 23:37 — forked from douglasduteil/.travis.yml
Here is how I allow Git SSH authentication in Travis CI. I'm using it to connect Travis to my repo organization AngularUI. This trick is a fork. The goal is to encode the RSA private deploy key in the .travis.yml as "-secure: xxxxx.....".
---
language: node_js
node_js:
- '0.10'
branches:
only:
- master
before_script: .travis/before_script.sh
script: echo -e " >>> Do something... \"grunt\" for example\n"
after_success: .travis/after_success.sh
@mashenjun
mashenjun / API.md
Created November 29, 2017 10:50 — forked from iros/API.md
Documenting your REST API

Title

<Additional information about your API call. Try to use verbs that match both request type (fetching vs modifying) and plurality (one vs multiple).>

  • URL

    <The URL Structure (path only, no root url)>

  • Method:

@mashenjun
mashenjun / docker-cleanup-resources.md
Created March 6, 2018 06:10 — forked from bastman/docker-cleanup-resources.md
docker cleanup guide: containers, images, volumes, networks

Docker - How to cleanup (unused) resources

Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...

delete volumes

// see: https://github.com/chadoe/docker-cleanup-volumes

$ docker volume rm $(docker volume ls -qf dangling=true)

$ docker volume ls -qf dangling=true | xargs -r docker volume rm

@mashenjun
mashenjun / git_cheat-sheet.md
Created May 16, 2018 05:53 — forked from davfre/git_cheat-sheet.md
git commandline cheat-sheet
# Path to your oh-my-zsh installation.
export ZSH=/Users/mashenjun/.oh-my-zsh
# Set name of the theme to load.
# Look in ~/.oh-my-zsh/themes/
# Optionally, if you set this to "random", it'll load a random theme each
# time that oh-my-zsh is loaded.
ZSH_THEME="powerlevel9k/powerlevel9k"
# replace the “user@hostname” info
GOPATH=$(shell echo $$GOPATH)
GOBIN=$(shell pwd)/bin
GOFILES=$(wildcard *.go)
GONAME=$(shell basename "$(PWD)")
PID=/tmp/go-$(GONAME).pid
CONFIG_PATH = ./configs/conf.toml
build:
@echo "Building $(GOFILES) to ./bin"
@GOPATH=$(GOPATH) GOBIN=$(GOBIN) go build -race -o bin/$(GONAME) $(GOFILES)
#!/bin/bash
usage () {
echo "Don't run this script directly, instead type 'source goactivate'.
Script to set PATH, GOPATH and shell prompt for your project. Drop this script
in your PATH. To activate environment, go in the root directory of the project
and type:
@mashenjun
mashenjun / from.yaml
Last active April 25, 2022 01:42 — forked from Daniel-ltw/from.yaml
Github Actions repository_dispatch example
name: Build Artifacts
on: [push]
jobs:
build:
runs-on: ubuntu-latest
steps:
{"$defs":{"extraVolumeTags":{"patternProperties":{"^.*$":{"maxLength":256,"minLength":0,"pattern":"^[a-zA-Z0-9 _.:/=+-@]*$","type":"string"}},"propertyNames":{"maxLength":128,"minLength":1,"pattern":"^[a-zA-Z0-9 _.:/=+-@]*$","type":"string"},"type":"object"}},"$schema":"https://json-schema.org/draft/2019-09/schema","additionalProperties":false,"description":"Configurable parameters of the AWS EBS CSI Driver","properties":{"a1CompatibilityDaemonSet":{"default":false,"description":"Enable compatibility for the A1 instance family via use of an AL2-based image in a separate DaemonSet","type":"boolean"},"additionalDaemonSets":{"default":{},"description":"Additional DaemonSets of the node pod","patternProperties":{"^.*$":{"$ref":"#/properties/node","type":"object"}},"type":"object"},"controller":{"additionalProperties":false,"properties":{"additionalArgs":{"default":[],"description":"Additional arguments passed to the controller pod","items":{"type":"string"},"type":"array"},"affinity":{"default":{"affinity":{"node