Skip to content

Instantly share code, notes, and snippets.

@bussiere
bussiere / weechat.txt
Created March 13, 2019 14:45
prevision
on se dirige en occident et en france a un systeme a la weechat ou l'app de chat fait tout.
@bussiere
bussiere / cuter.py
Created February 24, 2019 15:01 — forked from sigilioso/cuter.py
Python PIL Example: get a thumbnail by resizing and cropping an image.
# -*- coding: utf-8 -*-
import Image
def resize_and_crop(img_path, modified_path, size, crop_type='top'):
"""
Resize and crop an image to fit the specified size.
args:
img_path: path for the image to resize.
@bussiere
bussiere / mountzfs.sh
Created February 9, 2019 12:56
mount zfs
root@Kusanagi:/home/bussiere# zpool import storedb
root@Kusanagi:/home/bussiere# zfs set mountpoint=/Data storedb
root@Kusanagi:/home/bussiere# systemctl restart postgresql
@bussiere
bussiere / zfs
Created February 8, 2019 08:07
mount zfs
root@Kusanagi:/home/bussiere# zpool import storedb
root@Kusanagi:/home/bussiere# zfs set mountpoint=/Data storedb
@bussiere
bussiere / format_json.sh
Created February 5, 2019 16:52
Format a json file with python in command line shell
python3 -m json.tool < export_05_02_2019_AT_17_28_final.json > final.json
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@bussiere
bussiere / HaversinFormula.go
Last active January 16, 2019 21:47 — forked from cdipaolo/HaversinFormula.go
Golang functions to calculate the distance in meters between long,lat points on Earth.
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
@bussiere
bussiere / migrate-django.md
Created January 5, 2019 13:10 — forked from sirodoht/migrate-django.md
How to migrate Django from SQLite to PostgreSQL

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:

@bussiere
bussiere / test.go
Created December 8, 2018 10:15
starlight python golang
package main
import (
"fmt"
"github.com/starlight-go/starlight"
)
type contact struct {
Name string
}
@bussiere
bussiere / sendjsonwgo.go
Created November 28, 2018 10:13
Send json with 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)