go build -o myservice
# installs and starts
./myservice
# plist file should be created
ls ~/Library/LaunchAgents/
This file contains hidden or 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
| log stdout | |
| errors stdout | |
| auto_https off | |
| http://myapp.fly.dev { | |
| reverse_proxy 100.120.108.62:8000 | |
| } |
This file contains hidden or 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
| package main | |
| import ( | |
| "database/sql" | |
| "fmt" | |
| "net" | |
| "os" | |
| "github.com/go-sql-driver/mysql" | |
| "golang.org/x/crypto/ssh" |
Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...
// 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
This file contains hidden or 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 kill $(docker ps -a -q) | |
| docker rm -f $(docker ps -a -q) | |
| docker-machine stop default | |
| docker-machine start default |
This file contains hidden or 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 | |
| export vault=/usr/local/bin/vault | |
| export VAULT_TOKEN=$(cat /root/.vault-token) | |
| vault_cacert='-ca-cert=/path/to/your/ca.pem' | |
| local_vault="-address=https://$(hostname -f):8200" | |
| unsealed_vault="-address=https://$(getent hosts $(dig +short vault.service.consul | tail -n 1) | awk '{ print $2 }'):8200" | |
| leader_vault="-address=https://$($vault status $vault_cacert $unsealed_vault 2> /dev/null | grep Leader | awk '{ print $2 }' | sed 's/^http\(\|s\):\/\///g'):8200" | |
| vault_read="$vault read $vault_cacert $leader_vault" | |
| vault_unseal="$vault unseal $vault_cacert $local_vault" |
This file contains hidden or 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
| package join | |
| import ( | |
| "fmt" | |
| "strings" | |
| "testing" | |
| ) | |
| var ( | |
| testData = []string{"a", "b", "c", "d", "e"} |
This file contains hidden or 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
| class var userDateFormatter : NSDateFormatter { | |
| struct Static { | |
| static let instance: NSDateFormatter = { | |
| let dateFormatter = NSDateFormatter() | |
| dateFormatter.dateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'" | |
| return dateFormatter | |
| }() | |
| } | |
| return Static.instance | |
| } |
NewerOlder