This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# adopted from https://gist.github.com/Belphemur/3c022598919e6a1788fc | |
# includes neverbleed patch | |
# names of latest versions of each package | |
export NGINX_VERSION=1.11.1 | |
export VERSION_PCRE=pcre-8.38 | |
export VERSION_LIBRESSL=libressl-2.4.1 | |
export VERSION_NGINX=nginx-$NGINX_VERSION |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# How to use "acme.sh" to set up Lets Encrypt without root permissions | |
# See https://github.com/Neilpang/acme.sh for more | |
# This assumes that your website has a webroot at "/var/www/<domain>" | |
# I'll use the domain "EXAMPLE.com" as an example | |
# When this is done, there will be an "acme" user that handles issuing, | |
# updating, and installing certificates. This account will have the following | |
# (fairly minimal) permissions: | |
# - Host files at http://EXAMPLE.com/.well-known/acme-challenge |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fs = require('fs') | |
const WebSocket = require('ws'); | |
const wsoptions = { | |
cert: fs.readFileSync('../../.config/lxc/client.crt'), | |
key: fs.readFileSync('../../.config/lxc/client.key'), | |
rejectUnauthorized: false | |
} | |
var ws = new WebSocket('wss://127.0.0.1:8443/1.0/events?type=operation', wsoptions); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
about | |
admin | |
blog | |
calendar | |
contact | |
copyright | |
dashboard | |
errors | |
events |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
from django.db.models import Model | |
from django.contrib.contenttypes.fields import GenericForeignKey | |
from django.db.utils import IntegrityError | |
from django.db import transaction | |
from urllib import parse | |
try: | |
from django.apps import apps |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM ubuntu:14.04 | |
ENV BUCKET your-s3-bucket | |
RUN apt-get update && apt-get install -y wget \ | |
build-essential python-dev \ | |
libssl-dev libffi-dev \ | |
libpcre3-dev \ | |
libmemcached-dev \ | |
libpq-dev \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function () { | |
var perfBar = function(budget) { | |
window.onload = function() { | |
window.performance = window.performance || window.mozPerformance || window.msPerformance || window.webkitPerformance || {}; | |
var timing = window.performance.timing, | |
now = new Date().getTime(), | |
output, loadTime; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import uuid | |
import psycopg2 | |
from psycopg2.extras import DictCursor | |
from django.conf import settings | |
from django.db import models | |
from django.contrib.auth.models import User | |
class classproperty(object): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Based on https://djangosnippets.org/snippets/2283/ | |
from django.db import transaction | |
from django.db.models import get_models, Model | |
from django.contrib.contenttypes.generic import GenericForeignKey | |
@transaction.atomic | |
def merge_model_objects(primary_object, alias_objects=None, keep_old=False): | |
""" | |
Use this function to merge model objects (i.e. Users, Organizations, Polls, |