Skip to content

Instantly share code, notes, and snippets.

View jscul's full-sized avatar

John Cullen jscul

View GitHub Profile
@miklb
miklb / moonphase.py
Created July 1, 2015 07:12
Calculate Lunar Phase
#!/usr/bin/env python
"""
moonphase.py - Calculate Lunar Phase
Author: Sean B. Palmer, inamidst.com
Cf. http://en.wikipedia.org/wiki/Lunar_phase#Lunar_phase_calculation
"""
import math, decimal, datetime
dec = decimal.Decimal
@xcsrz
xcsrz / center_text_on_image.py
Created March 8, 2017 00:17
Center text on an image with Python and OpenCV. Had to come up with it myself as no one was spelling this out anywhere (or google couldn't find it)
#!/usr/bin/env python
import numpy as np
import cv2
from time import sleep
# create blank image - y, x
img = np.zeros((600, 1000, 3), np.uint8)
# setup text