Dump existing data:
python3 manage.py dumpdata > datadump.json
Change settings.py to Postgres backend.
Make sure you can connect on PostgreSQL. Then:
package main | |
// This is an example of a resilient worker program written in Go. | |
// | |
// This program will run a worker, wait 5 seconds, and run it again. | |
// It exits when SIGINT or SIGTERM is received, while ensuring any ongoing work | |
// is finished before exiting. | |
// | |
// Unexpected panics are also handled: program won't crash if the worker panics. | |
// However, panics in goroutines started by the worker won't be handled and have |
// CSVToMap takes a reader and returns an array of dictionaries, using the header row as the keys | |
func CSVToMap(reader io.Reader) []map[string]string { | |
r := csv.NewReader(reader) | |
rows := []map[string]string{} | |
var header []string | |
for { | |
record, err := r.Read() | |
if err == io.EOF { | |
break | |
} |
// Embedded in this article https://medium.com/p/c98e491015b6 | |
package main | |
import ( | |
"fmt" | |
"log" | |
"net/http" | |
"time" | |
"github.com/graph-gophers/graphql-go" |
[ | |
{ | |
"name": "Aboleth", | |
"meta": "Large aberration, lawful evil", | |
"Armor Class": "17 (Natural Armor)", | |
"Hit Points": "135 (18d10 + 36)", | |
"Speed": "10 ft., swim 40 ft. ", | |
"STR": "21", | |
"STR_mod": "(+5)", | |
"DEX": "9", |
// CSVToMap takes a reader and returns an array of dictionaries, using the header row as the keys | |
func CSVToMap(reader io.Reader) []map[string]string { | |
r := csv.NewReader(reader) | |
rows := []map[string]string{} | |
var header []string | |
for { | |
record, err := r.Read() | |
if err == io.EOF { | |
break | |
} |
// 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 | |
// great arc distance on a sphere with accuracy for small distances | |
// |
Unicode table - List of most common Unicode characters * | |
* This summary list contains about 2000 characters for most common ocidental/latin languages and most printable symbols but not chinese, japanese, arab, archaic and some unprintable. | |
Contains character codes in HEX (hexadecimal), decimal number, name/description and corresponding printable symbol. | |
What is Unicode? | |
Unicode is a standard created to define letters of all languages and characters such as punctuation and technical symbols. Today, UNICODE (UTF-8) is the most used character set encoding (used by almost 70% of websites, in 2013). The second most used character set is ISO-8859-1 (about 20% of websites), but this old encoding format is being replaced by Unicode. | |
How to identify the Unicode number for a character? | |
Type or paste a character: |
// http://en.wikipedia.org/wiki/Pairing_function | |
package main | |
import ( | |
"fmt" | |
"math" | |
) | |
func InvertedCantorPairing(z int) (int, int) { | |
w := int(math.Floor((math.Sqrt(float64(8*z+1)) - 1) / 2)) |