Skip to content

Instantly share code, notes, and snippets.

View OdinsPlasmaRifle's full-sized avatar
💀
In an ancient crypt

Joshua van Besouw OdinsPlasmaRifle

💀
In an ancient crypt
View GitHub Profile

GIT Cheatsheet

Subtree

Basic subtree:

git subtree push --prefix {directory} origin gh-pages
@OdinsPlasmaRifle
OdinsPlasmaRifle / managers.py
Last active February 5, 2024 16:56
Haversine formula in Django using Postgres SQL
from django.db import models, connection
"""
Haversine formula in Django using Postgres SQL
Queries a model for all rows that are within a certain radius (given in meters) of a central point.
The 'location_model' placeholder should be raplaced with the name of the table (full name) that includes a latitude and longitude column.
The latitude and longitude columns should be decimal fields.
@OdinsPlasmaRifle
OdinsPlasmaRifle / jwt.go
Last active July 4, 2017 09:38
JWT Tokens using jwt-go
package components
import (
"crypto/rsa"
jwt "github.com/dgrijalva/jwt-go"
"io/ioutil"
"log"
"time"
)