Skip to content

Instantly share code, notes, and snippets.

View dirn's full-sized avatar
🤔

Andy Dirnberger dirn

🤔
View GitHub Profile
@mgreensmith
mgreensmith / Slack_solarized_themes
Last active December 21, 2023 19:29
Solarized themes for Slack
Solarized
#FDF6E3,#EEE8D5,#93A1A1,#FDF6E3,#EEE8D5,#657B83,#2AA198,#DC322F
Solarized Dark
#073642,#002B36,#B58900,#FDF6E3,#CB4B16,#FDF6E3,#2AA198,#DC322F
@tomdyson
tomdyson / getting-started-with-wagtail.md
Last active November 12, 2020 05:47
Getting started with Wagtail

Wagtail tutorial

Thanks to [Serafeim Papastefanos] for authoring this tutorial. Please note that the installation process is in flux; most of the steps here should soon be unnecessary.

[Wagtail] is a new Open Source [Django]-based CMS. In this 20 minute tutorial we will see how you can create a blog from scratch using Wagtail. If you want to see some more examples of usage please take a look at the [wagtaildemo] GitHub project.

To follow this tutorial you will need to have [Python] 2.7 installed with a working version of [pip] and [virtualenv].

Installing the wagtail dependencies

"""
This file contains code that, when run on Python 2.7.5 or earlier, creates
a string that should not exist: u'\Udeadbeef'. That's a single "character"
that's illegal in Python because it's outside the valid Unicode range.
It then uses it to crash various things in the Python standard library and
corrupt a database.
On Python 3... well, this file is full of syntax errors on Python 3. But
if you were to change the print statements and byte literals and stuff:
@jed
jed / how-to-set-up-stress-free-ssl-on-os-x.md
Last active February 25, 2024 17:35
How to set up stress-free SSL on an OS X development machine

How to set up stress-free SSL on an OS X development machine

One of the best ways to reduce complexity (read: stress) in web development is to minimize the differences between your development and production environments. After being frustrated by attempts to unify the approach to SSL on my local machine and in production, I searched for a workflow that would make the protocol invisible to me between all environments.

Most workflows make the following compromises:

  • Use HTTPS in production but HTTP locally. This is annoying because it makes the environments inconsistent, and the protocol choices leak up into the stack. For example, your web application needs to understand the underlying protocol when using the secure flag for cookies. If you don't get this right, your HTTP development server won't be able to read the cookies it writes, or worse, your HTTPS production server could pass sensitive cookies over an insecure connection.

  • Use production SSL certificates locally. This is annoying

@dirn
dirn / flattr.py
Last active December 18, 2015 02:58
Flatten
__all__ = ('flatten',)
from collections import Iterable
sentinel = []
def flatten(to_flatten):
flat = _flatten(to_flatten, lambda x: x)
while iterable(flat) and flat and callable(flat[0]):
@dirn
dirn / gist:3943102
Last active October 12, 2015 00:27
Sublime Text 2 Settings
{
"color_scheme": "Packages/Tomorrow-Night-Bright.tmTheme",
"detect_indentation": false,
"ensure_newline_at_eof_on_save": true,
"find_selected_text": true,
"fold_buttons": false,
"folder_exclude_patterns":
[
"_build",
"__pycache__",
@kennethreitz
kennethreitz / flaskapp.py
Created June 9, 2012 15:38
My typical flask app base
# -*- coding: utf-8 -*-
import os
from flask import Flask
from flask_heroku import Heroku
from flask_sslify import SSLify
from raven.contrib.flask import Sentry
from flask.ext.celery import Celery
@yaniv-aknin
yaniv-aknin / muroku.py
Created April 3, 2012 09:50
muroku: small utility to aid syncing staging/testing/live heroku environments
#!/usr/bin/env python
# Written by @aknin
# https://gist.github.com/gists/2290744
# This code has been placed in the public domain, no strings attached either way.
from __future__ import print_function
import platform
import os