Skip to content

Instantly share code, notes, and snippets.

# Some good references are:
# http://russbrooks.com/2010/11/25/install-postgresql-9-on-os-x
# http://www.paolocorti.net/2008/01/30/installing-postgis-on-ubuntu/
# http://postgis.refractions.net/documentation/manual-1.5/ch02.html#id2630392
#1. Install PostgreSQL postgis and postgres
brew install postgis
initdb /usr/local/var/postgres
pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start
@dnordberg
dnordberg / gist:5658920
Created May 27, 2013 20:26
Generate Swagger docs.
python -m api_docs --base-path='http://localhost:5000/api/v1/' --version=0.9 --app-module='app.app' --tables-module='models' --update-route-spec
python -m api_docs --base-path='http://localhost:5000/api/v1/' --version=0.9 --app-module='app.app' --tables-module='models' --update-index
@dnordberg
dnordberg / gist:5658936
Created May 27, 2013 20:30
Script used to help generate Swagger docs.
import re
import os
import argparse
import urlparse
import simplejson
from collections import defaultdict
from sqlalchemy.ext.declarative.api import DeclarativeMeta
SKIP_MODELS = ['BlogPost', 'BlogCategory', 'DBVersion']
@dnordberg
dnordberg / gist:5658957
Created May 27, 2013 20:36
Routes for Swagger json resources.
from flask import Response
RE_API_DOCS_BASE_PATH = re.compile(r'"basePath": "(.*)\/api\/')
API_SANDBOX_URL = '"basePath": "http://localhost:5000/api/'
@app.route('/api/v1/api-docs', methods=['GET'])
def api_docs_index():
return Response(RE_API_DOCS_BASE_PATH.sub(API_SANDBOX_URL,
open('./docs/api/v1/index.json').read()),
mimetype='application/json')
@dnordberg
dnordberg / api_docs.py
Last active May 9, 2016 22:43
Generate Swagger documentation stubs for flask-restless.
# Script used to help generate Swagger docs.
import re
import os
import argparse
import urlparse
import simplejson
from collections import defaultdict
from sqlalchemy.ext.declarative.api import DeclarativeMeta

Open the postgresql.conf config file:

$> mate /usr/local/var/postgres/postgresql.conf

Uncomment the line with 'log_destination' and set it to 'syslog'

log_destination = 'syslog'

Open the syslog config:

@dnordberg
dnordberg / trypy
Created February 21, 2014 20:30 — forked from naftaliharris/trypy
#!/bin/bash
# An enhancement to the "python" executable that automatically launches you into the python debugger on error.
#
# Use it like you would the "python" executable, for example:
# $ trypy somefile.py
# or
# $ trypy somefile.py arg1 arg2
#
# EXAMPLE:
@dnordberg
dnordberg / meteor-account-verify.js
Created August 2, 2016 21:13 — forked from olizilla/meteor-account-verify.js
Only allow users on a given email domain to log in to your meteor app.
/*
Only allow users with a verified email address on a pre-verified domain to log in.
We're getting people to authenticate and only authorising those that have an email we recognise.
Assumes a Meteor.settings like:
{ adminDomains: ['tableflip.io', 'meteor.com'] }
...and meteor-developer accounts, but other login mechanisms (email, twitter) would work too.
*/
@dnordberg
dnordberg / setup_shipyard_centos_7.sh
Last active July 24, 2018 21:46
setup shipyard on centos 7
!#/bin/bash
# Install docker, docker-compose, shipyard, fix ip4
yum -y update
mkdir /etc/systemd/system/docker.service.d
tee /etc/systemd/system/docker.service.d/docker.conf <<-'EOF'
[Service]
ExecStart=
@dnordberg
dnordberg / yandex_email_for_domain_settings.py
Created April 13, 2020 11:36 — forked from nskeip/yandex_email_for_domain_settings.py
Django SMTP settings for yandex_for_domain mail (pdd.yandex.ru)
EMAIL_HOST = 'smtp.yandex.ru'
EMAIL_HOST_USER = '[email protected]'
EMAIL_HOST_PASSWORD = 'password'
EMAIL_PORT = 465
EMAIL_USE_TLS = True