Instantly share code, notes, and snippets.

bussiere bussiere

View GitHub Profile
View mountzfs.sh
root@Kusanagi:/home/bussiere# zpool import storedb
root@Kusanagi:/home/bussiere# zfs set mountpoint=/Data storedb
root@Kusanagi:/home/bussiere# systemctl restart postgresql
View zfs
root@Kusanagi:/home/bussiere# zpool import storedb
root@Kusanagi:/home/bussiere# zfs set mountpoint=/Data storedb
View format_json.sh
python3 -m json.tool < export_05_02_2019_AT_17_28_final.json > final.json
View PickleRick.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View HaversinFormula.go
import "math"
// haversin(θ) function
func hsin(theta float64) float64 {
return math.Pow(math.Sin(theta/2), 2)
}
// Distance function returns the distance (in meters) between two points of
// a given longitude and latitude relatively accurately (using a spherical
// approximation of the Earth) through the Haversin Distance Formula for
View migrate-django.md

How to migrate Django from SQLite to PostgreSQL

Dump existing data:

python3 manage.py dumpdata > datadump.json

Change settings.py to Postgres backend.

Make sure you can connect on PostgreSQL. Then:

View test.go
package main
import (
"fmt"
"github.com/starlight-go/starlight"
)
type contact struct {
Name string
}
View sendjsonwgo.go
func main() {
var reception = Data{}
var sendData = Data{}
sendData.Fruit = "Melon"
url := "http://localhost:8309/"
fmt.Println("URL:>", url)
js, err := json.Marshal(sendData)
View receivejsonwgin.go
v1.POST("/login", func(c *gin.Context) {
var loginCmd LoginCommand
c.BindJSON(&loginCmd)
c.JSON(http.StatusOK, gin.H{"user": loginCmd.Username})
})
View receivejson.go
func test(w http.ResponseWriter, r *http.Request) {
var test = Data{}
var reception = Data{}
test.Fruit = "Banana"
body, err := ioutil.ReadAll(r.Body)
if err != nil {
panic(err)
}