Skip to content

Instantly share code, notes, and snippets.

View josephabrahams's full-sized avatar

Joseph Abrahams josephabrahams

View GitHub Profile
0x8659C0FF528275C010Ac23454F24e2ADE075505b
@josephabrahams
josephabrahams / opencv3_install.sh
Last active August 5, 2024 10:38
Install OpenCV 3 on macOS with Homebrew
brew tap homebrew/science
brew install opencv3 --without-numpy --without-python --with-python3
brew link --force opencv3
mkvirtualenv -p python3 cv
pip install numpy
ln -s /usr/local/opt/opencv3/lib/python3.6/site-packages/cv2.cpython-36m-darwin.so \
~/.virtualenvs/cv/lib/python3.6/site-packages
@josephabrahams
josephabrahams / base.twig
Last active June 10, 2017 18:43
WP Timber Boilerplate
<!DOCTYPE html>
<html lang="en" class="no-js">
<head>
<title>{% if wp_title %}{{ post.title }} - {{ site.name }}{% else %}{{ site.name }} - {{ site.description }}{% endif %}</title>
<meta charset="{{ site.charset }}">
<meta name="description" content="{{ site.description }}">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<meta property="og:title" content="{% if wp_title %}{{ post.title }} - {% endif %}{{ site.name }}">
<meta property="og:description" content="{{ site.description }}">
<meta property="og:image" content="{{ theme.link }}/static/img/share-logo.jpg">
@josephabrahams
josephabrahams / wpsalt.sh
Last active March 30, 2022 08:30
Get WordPress Salts in Env format
#!/bin/sh
curl -s https://api.wordpress.org/secret-key/1.1/salt | sed "s/^define('\(.*\)',\ *'\(.*\)');$/\1='\2'/g"
@josephabrahams
josephabrahams / wp_php_ext.txt
Created April 22, 2016 21:23
WordPress 4.5 Required PHP Extensions
Extension Matches REF EXT min/Max PHP min/Max PHP all
-------------------------------------------------------------
Core Core 5.3.0 5.3.0
PDO PDO 5.1.0 5.1.0
Reflection Reflection 5.0.0 5.0.0
SimpleXML SimpleXML 5.0.1 5.0.1
com_dotnet user 4.0.0
ctype ctype 4.0.4 4.0.4
curl curl 4.0.4 4.0.4
date date 5.2.0 5.2.0
@josephabrahams
josephabrahams / post_compile
Last active April 21, 2016 21:55
Configuring a Heroku app to use an AWS RDS instance
#!/bin/bash
mkdir ./config && curl http://s3.amazonaws.com/rds-downloads/rds-combined-ca-bundle.pem > ./config/amazon-rds-ca-cert.pem
#DATABASE_URL=postgres://user:password@host:port/database?sslca=config/amazon-rds-ca-cert.pem
@josephabrahams
josephabrahams / frameworkpython
Last active March 30, 2020 20:36
Use a framework build of Python with virtualenv
#!/bin/bash
# On OSX, two different types of Python builds exist: a regular build and
# a framework build. In order to interact correctly with some GUI
# frameworks, you need to use a framework build. Unfortuantly, on OSX
# virtualenv always uses a regular build.
#
# The best known workaround, borrowed from the WX wiki, is to use the non-
# virtualenv Python along with the PYTHONHOME environment variable.
# See: http://matplotlib.org/faq/virtualenv_faq.html#osx
@josephabrahams
josephabrahams / circle.yml
Created October 26, 2015 18:57
Use .nvmrc with CircleCI
machine:
post:
- nvm use && nvm alias default $(nvm current)

Docker on Mac OS X

These are my notes based on my experience with using Docker on Mac OS X.

Assumptions

If these assumptions are not true for you, then this document may not be for you.

I assume you have these installed:

  • recent-ish Mac OS X
@josephabrahams
josephabrahams / admin.py
Created May 31, 2015 17:55
Limit number of Django model instances
from django.contrib import admin
from example.models import Example
class ExampleAdmin(admin.ModelAdmin):
"""
Don't allow addition of more than one model instance in Django admin
See: http://stackoverflow.com/a/12469482
"""
def has_add_permission(self, request):