Skip to content

Instantly share code, notes, and snippets.

@Deja-Vu1
Deja-Vu1 / praytimes.py
Created August 9, 2021 12:21
Fix for the python code version 2 of the Pray Times algorithm http://praytimes.org/code/ (Berkin İlkan Seçkin)
#!/usr/bin/env python
# compatible with python 2.x and 3.x
import math
import re
'''
--------------------- Copyright Block ----------------------
praytimes.py: Prayer Times Calculator (ver 2.3)
@tachyondecay
tachyondecay / models.py
Last active March 19, 2024 19:08
Tags in Flask via SQLalchemy and association proxies
from app import db
from sqlalchemy import desc, event, func, orm
from sqlalchemy.ext.associationproxy import association_proxy
from sqlalchemy.ext.declarative import declared_attr
from sqlalchemy_utils import ArrowType, auto_delete_orphans
from slugify import slugify_unicode
tags = db.Table('tag_associations',
db.Column('tag_id', db.Integer, db.ForeignKey('tags.id')),
db.Column('article_id', db.Integer, db.ForeignKey('articles.id')))
@uolter
uolter / setup-web2py-ubuntu.sh
Created January 26, 2014 15:00
Set up web2py to run on Ubuntu with apache and mod_wsi
echo "This script will:
1) install all modules need to run web2py on Ubuntu/Debian
2) install web2py in /home/www-data/
3) create a self signed sll certificate
4) setup web2py with mod_wsgi
5) overwrite /etc/apache2/sites-available/default
6) restart apache.
You may want to read this script before running it.
import os
from fabric.api import env, require, run, sudo, cd
env.project_name = ''
env.server_name = ''
env.webapps_root = '/opt/webapps/'
env.project_root = os.path.join(env.webapps_root, env.project_name)
env.activate_script = os.path.join(env.project_root, 'env/bin/activate')
env.wsgi_file = os.path.join(env.project_root, 'django.wsgi')