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 ( | |
"net/http" | |
"log" | |
) | |
func redirect(w http.ResponseWriter, req *http.Request) { | |
// remove/add not default ports from req.Host | |
target := "https://" + req.Host + req.URL.Path | |
if len(req.URL.RawQuery) > 0 { |
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
/* | |
go build for linux: | |
env GOOS=linux go build -o /tmp/server server.go | |
run with docker: | |
docker run -it --rm --name test -v /tmp/server:/server -p 3000:80 -p 3001:6060 alpine /server | |
run pprof debugger: | |
go get github.com/google/pprof | |
pprof --seconds 30 -http=:4444 /tmp/server http://localhost:3001/debug/pprof/profile |
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 ( | |
"crypto/tls" | |
"fmt" | |
"log" | |
"net" | |
"net/http" | |
) |
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 ( | |
"bytes" | |
"encoding/json" | |
"fmt" | |
"io/ioutil" | |
"net/http" | |
) |
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 pocketbase | |
import ( | |
"errors" | |
"fmt" | |
"github.com/duke-git/lancet/v2/convertor" | |
"github.com/go-resty/resty/v2" | |
"golang.org/x/sync/singleflight" | |
"time" | |
) |
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
type ( | |
// BuoyCondition contains information for an individual station. | |
BuoyCondition struct { | |
WindSpeed float64 `bson:"wind_speed_milehour"` | |
WindDirection int `bson:"wind_direction_degnorth"` | |
WindGust float64 `bson:"gust_wind_speed_milehour"` | |
} | |
// BuoyLocation contains the buoy's location. | |
BuoyLocation struct { |
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
[dev] | |
url = "http://dev.example.com" | |
username = "dev.account" | |
password = "devdev" | |
[test] | |
url = "http://test.example.com" | |
username = "test.account" | |
password = "testtest" |
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 | |
########### | |
# ./convert_repo.sh | |
# Author: Igor Serko <[email protected]> | |
# Description: Allows the user to join multiple git repositories under one single repository | |
# Procedure: Using git filter-branch we rewrite the history of every repo | |
# example of current tree | |
# -- REPOONE | |
# |-- repoone files | |
# -- REPOTWO |
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
Source link: https://stackoverflow.com/questions/31374085/installing-adb-on-macos | |
# Option 1 - Using Homebrew | |
This is the easiest way and will provide automatic updates. | |
1. Install [homebrew](http://brew.sh/) | |
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" | |
2. Install adb |
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
// gin will throw following for the first time due to secure initiate a http.Redirect but gin is unaware of it | |
// [GIN-debug] [WARNING] Headers were already written. Wanted to override status code 301 with 200 | |
package main | |
import ( | |
"github.com/gin-gonic/gin" | |
"github.com/unrolled/secure" | |
) |