View gist:dd62555bea2d1aa227acfc51974fc49a
/**
* return the angle between two points.
*
* @param {number} x1 x position of first point
* @param {number} y1 y position of first point
* @param {number} x2 x position of second point
* @param {number} y2 y position of second point
* @return {number} angle between two points (in radian)
*/
Math.getAngle = function( x1, y1, x2, y2 ) {
View bench.py
import time
import pprint
phrase = """ Britney Jean Spears (born December 2, 1981) is an American singer, dancer and actress. Born in
McComb, Mississippi, and raised in Kentwood, Louisiana, she performed acting roles in stage
productions and television shows as a child before signing with Jive Records in 1997. Spears's first
and second studio albums, ...Baby One More Time (1999) and Oops!... I Did It Again (2000), became
international successes, with the former becoming the best-selling album by a teenage solo
artist.[1] Title tracks "...Baby One More Time" and "Oops!... I Did It Again" broke international
sales records. In 2001, Spears released her self-titled third studio album, Britney, and played the
View kepler.py
import math
#import sys
#import sunau
#import array
"""
ecc=0.5
P=1
p=1
if len(sys.argv)>1:
ecc=float(sys.argv[1])
View activity.py
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
from cogs.utils.dataIO import dataIO
from __main__ import send_cmd_help
from discord.ext import commands
import asyncio
View astrogenerator.py
import random
from flatlib.datetime import Datetime
from flatlib.geopos import GeoPos
from flatlib.chart import Chart
from flatlib.aspects import getAspect
from flatlib import const
wise_connective = ['in', 'with', 'for', 'as']
aspects = {}
aspects['applicative'] = {
View mollweide.py
#!/usr/bin/env python3
from math import sin, cos, pi, sqrt, asin, log
sqrt2 = sqrt(2)
def solveNR(lat, epsilon=1e-6):
"""Solve the equation $2\theta\sin(2\theta)=\pi\sin(\mathrm{lat})$
using Newtons method"""
if abs(lat) == pi / 2:
View activate_timezone.py
import pytz
from django.utils import timezone
....
timezone.activate(pytz.timezone(user_time_zone))
View models.py
from django.db import models
from django.utils import timezone
from django.contrib.auth.models import (AbstractBaseUser,
BaseUserManager as DjBaseUserManager)
from model_utils.managers import InheritanceManager
class BaseUserManager(DjBaseUserManager, InheritanceManager):
"""
View models.py
# ...
class Category(Base):
slug = models.SlugField(_(u'slug'), max_length=100, unique=True)
title = models.CharField(_(u'title'), max_length=250)
parent = models.ForeignKey('self', blank=True, null=True, related_name='child')
class Meta:
verbose_name_plural = 'Categories'
View zip2tz.csv
We can't make this file beautiful and searchable because it's too large.
'00501','Holtsville','NY','America/New_York'
'00544','Holtsville','NY','America/New_York'
'01001','Agawam','MA','America/New_York'
'01002','Amherst','MA','America/New_York'
'01003','Amherst','MA','America/New_York'
'01004','Amherst','MA','America/New_York'
'01005','Barre','MA','America/New_York'
'01007','Belchertown','MA','America/New_York'
'01008','Blandford','MA','America/New_York'