Skip to content

Instantly share code, notes, and snippets.

@joshfinnie
joshfinnie / mastodon_python.csv
Last active January 25, 2023 00:45
A CSV of Python people on Mastodon for easy import (major work done here: https://gist.github.com/samuelcolvin/1743d8919acb465c1fbbcea2c3cdaf3e)
Account address Show boosts Notify on new posts Languages
@dabeaz@mastodon.social true false
@tiangolo@fosstodon.org true false
@mitsuhiko@hachyderm.io true false
@simon@simonwillison.net true false
@nedbat@hachyderm.io true false
@mkennedy@fosstodon.org true false
@willmcgugan@mastodon.social true false
@pamelafox@fosstodon.org true false
@ambv@mastodon.social true false
@joshfinnie
joshfinnie / gist:4046138
Created November 9, 2012 14:54
Installing Mezzanine on Heroku

Lately, I have been looking into Python CMSs. There are many out there, but for some reason or another Mezzanine stuck out as one I should try. Installing it is easy enough, but getting it up on running on my new favorite host, Heroku, was a bit of a challege.

Below you will find the steps that I took to get Mezzanine up and running on Heroku. Please let me know in the comments below if anything didn't work for you.

Setting up the Database

Heroku is shortly depricating Django's standard DATABASES dictionary in favor for a package which takes OS Environment Variables and builds the required dictionary for you. This is a good thing because it makes setting up a database on Heroku very easy. The package is called dj_database_url and it makes short work of getting a PostgreSQL database up and running with Mezzanine. Below is the code that you want to put in Mezzanine's DATABASES section:

import dj_database_url
DATABASES = {'default': dj_database_url.config(default='postgres://localhost')}
(function(){ console.log("hacked!"); }());

Const for Hello World of ES2015 in Node Core

Example 1

const foo = "foo";
foo = "bar"; // should not assign
console.log(foo);

PYTHON

def foo(var="default"):
   print(var)


$ foo()
default

$ foo("not default")

@joshfinnie
joshfinnie / index.html
Created January 15, 2014 04:06
The source code for my Raspberry Pi "Dashboard"
!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="http://netdna.bootstrapcdn.com/bootstrap/3.0.2/css/bootstrap.min.css">
<title>Today</title>
<script src="http://code.jquery.com/jquery-1.10.2.min.js"></script>
<style type="text/css">
body {
font-family: "HelveticaNeue-UltraLight", "Helvetica Neue UltraLight", "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
background-color: #B2E6FF;
@joshfinnie
joshfinnie / request.py
Created December 30, 2015 16:30
Which one is better??
try:
response = requests.post(
"<URL>",
auth=(
os.environ.get('<USERNAME>'),
os.environ.get('<PASSWORD>')
),
data=json.dumps(payload))
except Exception as e:
# do something
@joshfinnie
joshfinnie / writeup.md
Last active December 30, 2015 09:19
Node.DC Office Hours writeup

After the success of our last meetup, Hack Night, we are continuing the trend with a different kind of meetup, Office Hours.

This is a casual "geek gathering", where you can hack on a node.js project, get help/advice, or ask questions about anything node.js related. Anyone working with node.js at any level (or anyone wanting to work with it) is welcome.

Our meetups are always filled with a mix of people and skills present, and I expect this to be the same. So feel free to bring your questions pertaining to system admin/dev ops, best practices, installation issues, etc.

We are also looking for food/drink sponsors in exchange for five to ten minutes of air time to announce your product/hiring/etc. Contact Josh Finnie for details.

Attendance is free, and food and drink will be provided if we have found some sponsors. For this reason, it is mandatory that you keep your RSVP up to date. The deadline for changing your mind will be one day before the event.

@joshfinnie
joshfinnie / install.txt
Created October 2, 2013 14:42
How I install Python on OS X
$ cd /tmp
$ curl -O http://python.org/ftp/python/X.Y.Z/Python-X.Y.Z.tgz
$ tar zxf Python-X.Y.Z.tgz
$ cd Python-X.Y.Z
$ ./configure --prefix=/usr/local/python/X.Y.Z
$ make
$ make install
$ wget https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py -O - | /usr/local/python/X.Y.Z/bin/python
$ /usr/local/python/X.Y.Z/bin/easy_install pip
$ /usr/local/python/X.Y.Z/bin/pip install virtualenv
@joshfinnie
joshfinnie / setup.py
Created July 25, 2013 22:29
Start of a setup.py
#!/usr/bin/env python
import os
import sys
import app
try:
from setuptools import setup
except ImportError: