Skip to content

Instantly share code, notes, and snippets.

ssl_stapling on;
ssl on;
ssl_certificate /etc/nginx/ssl/bundle.crt;
ssl_certificate_key /etc/nginx/ssl/private/server.key;
ssl_session_timeout 24h;
ssl_session_cache shared:SSL:2m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
ssl_ciphers 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:AES:CAMELLIA:DES-CBC3-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!aECDH:!EDH-DSS-DES-CBC3-SHA:!EDH-RSA-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA';
ssl_
@syabro
syabro / test_migrations_conflicts.py
Last active August 29, 2015 14:25
Testcase for testing migrations conflicts
"""
To speedup tests many developers disables migrations in tests
F.e.
apps = [app.split('.')[-1] for app in INSTALLED_APPS]
MIGRATION_MODULES = {app: "%s.skip_migrations" % app for app in apps}
But bad thing about it that migrations aren't being tested for conflicts
until we run manage.py migrations
This testcase solves it.
"""
@syabro
syabro / check_static_files_links.py
Last active August 29, 2015 14:24
Test static files links existing
@syabro
syabro / find_duplicate_classes.py
Last active August 29, 2015 14:21
Python duplicate classes finder
import os
import re
from pprint import pprint
class_re = r'class (\w+)\((.*)\)'
classes = {}
for root, subdirs, files in os.walk('./homeowners'):
for file in files:
{15-03-23 13:24}ovh:/etc/uwsgi/vassals root# cat /etc/init.d/uwsgi
#!/bin/bash
### BEGIN INIT INFO
# Provides: uwsgi
# Required-Start: $local_fs $remote_fs $network
# Required-Stop: $local_fs $remote_fs $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start/stop uWSGI server instance(s)
# Description: This script manages uWSGI server instance(s).
<snippet>
<!-- put this file in /packages/User/<Folder Name>/console_log.sublime-snippet then restart your Sublime Text 2 -->
<content><![CDATA[console.log($1);$0]]></content>
<tabTrigger>conl</tabTrigger>
<scope>text.html,source.js</scope>
<description>console.log()</description>
</snippet>
<snippet>
<!-- put this in another file /packages/User/<Folder Name>/console_dir.sublime-snippet then restart your Sublime Text 2 -->
@syabro
syabro / directive.coffee
Created September 1, 2014 12:11
Plupload django directive
.directive('uploadFile', ($http, $timeout, $staticUrl, $cookies, $log, $attachedFileApiUrl)->
return {
restrict: 'A'
template: (tElement, tAttrs)->
return tElement[0].innerHTML
scope:
ngModel: '='
@syabro
syabro / asrticle.md
Created October 31, 2013 11:46
Article

This has bitten me twice in the last 3 days so I’m doing a quick post to remind myself. With AngularJS models, you typically have two way bindings between UI elements and your controller’s properties. Directly from the docs (Plunker)

<!doctype html>
<html ng-app>
 <head>
 <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.0.6/angular.min.js"></script>
 <script src="script.js"></script>
@syabro
syabro / middleware.py
Last active December 22, 2015 13:09 — forked from tomds/login.py
# Based on http://djangosnippets.org/snippets/1158/
import json
import re
from django.conf import settings
from django.http import HttpResponse, HttpResponseRedirect
class EnforceLoginMiddleware(object):
"""
// Generated on 2013-07-21 using generator-angular 0.3.0
'use strict';
var LIVERELOAD_PORT = 35729;
var lrSnippet = require('connect-livereload')({ port: LIVERELOAD_PORT });
var mountFolder = function (connect, dir) {
return connect.static(require('path').resolve(dir));
};
// # Globbing
// for performance reasons we're only matching one level down: