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
/* | |
Overview | |
-------- | |
To run a query using anorm you need to do three things: | |
1. Connect to the database (with or without a transaction) | |
2. Create an instance of `anorm.SqlQuery` using the `SQL` string interpolator | |
3. Call one of the methods on `SqlQuery` to actually run the query |
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
r.ParseMultipartForm(32 << 20) | |
file, handler, err := r.FormFile("userphoto") | |
utils.HandleWarn(err) | |
defer file.Close() | |
fmt.Fprintf(w, "%v", handler.Header) | |
f, err := os.OpenFile("./uploads/user_avatars/"+handler.Filename, os.O_WRONLY|os.O_CREATE, 0666) | |
utils.HandleWarn(err) | |
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 | |
sudoapt-get install -y curl unzip | |
sudo mkdir -p /var/lib/consul | |
sudo mkdir -p /usr/share/consul | |
sudo mkdir -p /etc/consul/conf.d | |
curl -OL https://releases.hashicorp.com/consul/0.8.0/consul_0.8.0_linux_amd64.zip | |
unzip consul_0.8.0_linux_amd64.zip | |
sudo mv consul /usr/local/bin/consul |
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
# Make sure you grab the latest version | |
curl -OL https://github.com/google/protobuf/releases/download/v3.2.0/protoc-3.2.0-linux-x86_64.zip | |
# Unzip | |
unzip protoc-3.2.0-linux-x86_64.zip -d protoc3 | |
# Move protoc to /usr/local/bin/ | |
sudo mv protoc3/bin/* /usr/local/bin/ | |
# Move protoc3/include to /usr/local/include/ |
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
# Install go swagger | |
# https://github.com/go-swagger/go-swagger | |
latestv=$(curl -s https://api.github.com/repos/go-swagger/go-swagger/releases/latest | jq -r .tag_name) | |
sudo curl -o /usr/local/bin/swagger -L'#' https://github.com/go-swagger/go-swagger/releases/download/$latestv/swagger_$(echo `uname`|tr '[:upper:]' '[:lower:]')_amd64 | |
sudo chmod +x /usr/local/bin/swagger | |
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
# Install go kubernetes | |
# make sure you have godep: go get github.com/tools/godep | |
# make sure your $GOROOT/bin is in the right $PATH | |
# export PATH="$GOPATH/bin:$PATH" | |
# Just to make sure | |
# export PATH="$GOROOT/bin:$PATH" | |
go get -u k8s.io/kubernetes | |
cd $GOPATH/src/k8s.io/kubernetes |
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
# Settiing your ubuntu development machine | |
1. Install Consul: https://gist.github.com/SofyanHadiA/b5949dfa72f5c0c8348e6805ceef1b7c | |
2. Install Protobuf: https://gist.github.com/SofyanHadiA/37787e5ed098c97919b8c593f0ec44d8 | |
3. Install Go Swagger: https://gist.github.com/SofyanHadiA/600a3033421b44af0cecceb3ea58e23e | |
4. Install Go Kubernetes: https://gist.github.com/SofyanHadiA/21fa625b1ea5e6e66c8f949e74081cc2 | |
Have fun with: https://github.com/micro/go-micro |
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
# Replace string starts with new line with content inside dquote | |
\n.*aria-label=".*" |
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
ls | awk '$0="import "$0" from \""$0"\";"' |
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
Minimum eight characters, at least one letter and one number: | |
"^(?=.*[A-Za-z])(?=.*\d)[A-Za-z\d]{8,}$" | |
Minimum eight characters, at least one letter, one number and one special character: | |
"^(?=.*[A-Za-z])(?=.*\d)(?=.*[$@$!%*#?&])[A-Za-z\d$@$!%*#?&]{8,}$" | |
Minimum eight characters, at least one uppercase letter, one lowercase letter and one number: | |
"^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)[a-zA-Z\d]{8,}$" | |
Minimum eight characters, at least one uppercase letter, one lowercase letter, one number and one special character: |
OlderNewer