This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Ref: | |
# - https://pretzelhands.com/posts/command-line-flags | |
# Usage: | |
# go test -race -v -coverprofile=coverage.out | |
# ./cover-check.sh coverage.out 70 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# == Builder == | |
FROM golang:1.13.7-alpine3.11 as builder | |
RUN apk add --no-cache \ | |
bash=5.0.11-r1 \ | |
git=2.24.1-r0 \ | |
mercurial=5.2.1-r0 \ | |
openssh-client=8.1_p1-r0 | |
ARG SSH_PRIVATE_KEY |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# docker completion | |
curl -fLo ~/.zprezto/modules/completion/external/src/_docker https://raw.githubusercontent.com/docker/cli/master/contrib/completion/zsh/_docker | |
# docker-compose completion | |
curl -fLo ~/.zprezto/modules/completion/external/src/_docker-compose https://raw.githubusercontent.com/docker/compose/master/contrib/completion/zsh/_docker-compose | |
compinit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"go.autocompleteUnimportedPackages": true, | |
"go.gocodeAutoBuild": true, | |
"go.buildOnSave": "off", | |
"go.testOnSave": true, | |
"go.testFlags": ["-short"], | |
"go.lintTool": "golangci-lint", | |
"go.lintFlags": [ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!bin/sh | |
golangci-lint run \ | |
--exclude-use-default=false \ | |
--enable=golint \ | |
--enable=gocyclo \ | |
--enable=goconst \ | |
--enable=unconvert \ | |
--exclude='^Error return value of `.*\.Log` is not checked$$' \ | |
--exclude='^G104: Errors unhandled\.$$' \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- pipeline: "Staging " | |
trigger_mode: "ON_EVERY_PUSH" | |
ref_name: "master" | |
ref_type: "BRANCH" | |
actions: | |
- action: "Build Docker image" | |
type: "DOCKERFILE" | |
login: "$DOCKER_LOGIN" | |
password: "$DOCKER_PASS" | |
docker_image_tag: "$BUDDY_EXECUTION_REVISION,stage" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function timeout(millis) { | |
return new Promise((resolve, reject) => { | |
setTimeout(resolve, millis); | |
}); | |
} | |
class Dispatcher { | |
constructor() { | |
this.listeners = []; | |
this.delayedListeners = []; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Timeout promise for delaying something | |
function timeout(millis) { | |
return new Promise((resolve, reject) => { | |
setTimeout(() => { | |
resolve(); | |
}, millis); | |
}) | |
} | |
// Costly function, it require 1sec every invocation. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const jsonTimeLayout = "2006-01-02T15:04:05+07:00" | |
// JSONTime is the time.Time with JSON marshal and unmarshal capability | |
type JSONTime struct { | |
time.Time | |
} | |
// UnmarshalJSON will unmarshal using 2006-01-02T15:04:05+07:00 layout | |
func (t *JSONTime) UnmarshalJSON(b []byte) error { | |
parsed, err := time.Parse(jsonTimeLayout, string(b)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
for i in {1..10000}; do | |
echo "[$(date)] - Lorem ipsum dolor sit amet, consectetur adipisicing elit -> $i" >> log/app.log; | |
done |
NewerOlder