Skip to content

Instantly share code, notes, and snippets.

View weichou1229's full-sized avatar
🎯
Focusing

Bruce Huang weichou1229

🎯
Focusing
View GitHub Profile
@weichou1229
weichou1229 / docker.yml
Created March 24, 2019 09:20 — forked from rbq/docker.yaml
Install Docker CE on Ubuntu using Ansible
---
- hosts: all
tasks:
- name: Install prerequisites
apt: name={{item}} update_cache=yes
with_items:
- apt-transport-https
- ca-certificates
- curl
- software-properties-common
@weichou1229
weichou1229 / multipart_upload.go
Last active September 19, 2018 07:42
Golang multipart_upload
package http
import (
"bytes"
"fmt"
"io"
"io/ioutil"
"mime/multipart"
"net/http"
"path/filepath"
@weichou1229
weichou1229 / cmd.sh
Created March 2, 2018 01:56 — forked from kelvinn/cmd.sh
Example of using Apache Bench (ab) to POST JSON to an API
# post_loc.txt contains the json you want to post
# -p means to POST it
# -H adds an Auth header (could be Basic or Token)
# -T sets the Content-Type
# -c is concurrent clients
# -n is the number of requests to run in the test
ab -p post_loc.txt -T application/json -H 'Authorization: Token abcd1234' -c 10 -n 2000 http://example.com/api/v1/locations/
@weichou1229
weichou1229 / git-tag-delete-local-and-remote.sh
Created February 21, 2018 06:43 — forked from mobilemind/git-tag-delete-local-and-remote.sh
how to delete a git tag locally and remote
# delete local tag '12345'
git tag -d 12345
# delete remote tag '12345' (eg, GitHub version too)
git push origin :refs/tags/12345
# alternative approach
git push --delete origin tagName
git tag -d tagName
@weichou1229
weichou1229 / CookieToole.js
Created September 20, 2017 02:18
javascript cookie
export class CookieService {
constructor(@Inject(DOCUMENT) public document) {
}
get(cookieName: string) {
const name = cookieName + "=";
const ca = document.cookie.split(';');
for (var i = 0; i < ca.length; i++) {
let c = ca[i];