Skip to content

Instantly share code, notes, and snippets.

View tr00st's full-sized avatar

James Cheese tr00st

View GitHub Profile
@tr00st
tr00st / switch_to_python3.4.sh
Last active May 19, 2022 14:40
DO NOT USE: OUT OF DATE & UNMAINTAINED - Python 3 upgrade script for the Django image on DigitalOcean
#!/bin/bash
#
# Copyright 2015 James Cheese
# You may do anything with this work that copyright law would normally
# restrict, so long as you retain the above notice(s) and this license
# in all redistributed copies and derived works. There is no warranty.
#
# Python 3 Upgrade for Django Droplet
# Will update the "Django on 14.04" Digital Ocean image.
# Run as root.
@tr00st
tr00st / README.md
Created April 28, 2015 10:02
Nginx + Django + Gunicorn + Python 3.4 Configs

What?

This is a minimal but effective set of configuration files and setup for running Django (targetted at 1.8) with Python 3.4, Gunicorn, Nginx

Why?

Because I'm sick and tired of writing this config over and over :)

@tr00st
tr00st / LICENSE
Created June 22, 2015 14:02
GeoDjango Setup - Ubuntu 12.04/14.04
The MIT License (MIT)
Copyright (c) 2015 James Cheese
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
@tr00st
tr00st / gist:76f2729e0467e83e117a
Last active August 29, 2015 14:24
SSL config options for nginx
# Remove legacy SSL support. If you really need it, you're supporting IE6 yourself. Sorry.
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
# Settings for cached SSL sessions.
ssl_session_cache shared:SSL:50m;
ssl_session_timeout 5m;
# Choose some DH params:
@tr00st
tr00st / .bashrc
Last active October 13, 2015 10:27
Coloured prompt lines for BASH
# Simple colour-coded prompts for BASH usage - red=live, blue=test, green=dev
#live:
export PS1="\[$(tput bold)\]\[\033[38;5;9m\]\u@\h\[$(tput sgr0)\]\[$(tput sgr0)\]\[\033[38;5;15m\]:\w\\$\[$(tput sgr0)\] "
#test:
export PS1="\[$(tput bold)\]\[\033[38;5;39m\]\u@\h\[$(tput sgr0)\]\[$(tput sgr0)\]\[\033[38;5;15m\]:\w\\$\[$(tput sgr0)\] "
#dev:
export PS1="\[$(tput bold)\]\[\033[38;5;119m\]\u@\h\[$(tput sgr0)\]\[$(tput sgr0)\]\[\033[38;5;15m\]:\w\\$\[$(tput sgr0)\] "
### Keybase proof
I hereby claim:
* I am tr00st on github.
* I am jamescheese (https://keybase.io/jamescheese) on keybase.
* I have a public key whose fingerprint is 6F3C F8FD 4114 7718 A16E A759 8D3B AE8A 8E0A A400
To claim this, I am signing this object:
@tr00st
tr00st / migration_postgis.py
Created September 29, 2016 13:17
PostGIS enabler migration
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = []
operations = [
migrations.RunSQL("CREATE EXTENSION IF NOT EXISTS postgis")
]
@tr00st
tr00st / rabbitmq-env.bat.diff
Created October 11, 2016 11:17
Patch for rabbitmq env file to pull cookie manually
--- rabbitmq-env-orig.bat Tue Oct 11 12:16:01 2016
+++ rabbitmq-env.bat Tue Oct 11 12:10:18 2016
@@ -1,10 +1,12 @@
@echo off
REM Scopes the variables to the current batch file
REM setlocal
+set /p COOKIE_VALUE=<%HOMEDRIVE%%HOMEPATH%\.erlang.cookie
+
@tr00st
tr00st / settings.py
Created October 13, 2016 09:18
GeoDjango Win64 workarounds
# First install GDAL as a wheel from: http://www.lfd.uci.edu/~gohlke/pythonlibs/#gdal
# Then ensure the following are added to your local settings.py (check the dll name, this may change!)
GDAL_LIBRARY_PATH = r"env\Lib\site-packages\osgeo\gdal200.dll"
environ["PATH"] = "{};{}".format(r"env\Lib\site-packages\osgeo", environ["PATH"])
@tr00st
tr00st / mdstyles.css
Last active May 8, 2021 22:12
Dark colour scheme for MarkdownEditor (https://github.com/madskristensen/MarkdownEditor)
/*
* Dark colour scheme for MarkdownEditor (https://github.com/madskristensen/MarkdownEditor)
*
* Licensed under MIT license.
*
* Copyright (c) 2018 James Cheese
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights