Skip to content

Instantly share code, notes, and snippets.

View josephabrahams's full-sized avatar

Joseph Abrahams josephabrahams

View GitHub Profile
@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 / 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 / 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 / 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 / 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 / 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
0x8659C0FF528275C010Ac23454F24e2ADE075505b
@josephabrahams
josephabrahams / QSTK-Mac-Installation.md
Last active March 4, 2018 07:53
QSTK Mac Installation w/ Python 3

QSTK Mac Installation

Now with Python 3!

Install System Dependencies

brew install python
brew install pipenv
brew install gfortran
@josephabrahams
josephabrahams / s3-redirect-rule.xml
Created June 2, 2018 23:02
Redirect all requests from S3 bucket to another domain and strip the path.
<RoutingRules>
<RoutingRule>
<Redirect>
<HostName>example.com</HostName>
<HttpRedirectCode>301</HttpRedirectCode>
<Protocol>https</Protocol>
<ReplaceKeyWith/>
</Redirect>
</RoutingRule>
</RoutingRules>
@josephabrahams
josephabrahams / certbot
Created July 16, 2018 03:11
Let's Encrypt cert update cron
# /etc/cron.d/certbot: crontab entries for the certbot package
#
# Upstream recommends attempting renewal twice a day
#
# Eventually, this will be an opportunity to validate certificates
# haven't been revoked, etc. Renewal will only occur if expiration
# is within 30 days.
SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
AWS_CONFIG_FILE="/root/.aws/config"