Skip to content

Instantly share code, notes, and snippets.

View ryankirkman's full-sized avatar

Ryan Kirkman ryankirkman

View GitHub Profile
@ryankirkman
ryankirkman / SQLPrintingMiddleware.py
Created July 24, 2016 00:48 — forked from vstoykov/SQLPrintingMiddleware.py
Django Middleware to print sql queries in debug console
"""
Originaly code was taken from http://djangosnippets.org/snippets/290/
But I was made some improvements like:
- print URL from what queries was
- don't show queries from static URLs (MEDIA_URL and STATIC_URL, also for /favicon.ico).
- If DEBUG is False tell to django to not use this middleware
- Remove guessing of terminal width (This breaks the rendered SQL)
"""
from django.core.exceptions import MiddlewareNotUsed
from django.conf import settings
@ryankirkman
ryankirkman / .gitignore_global
Last active May 20, 2016 05:33 — forked from octocat/.gitignore
Some common .gitignore configurations
# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so
*.pyc
@ryankirkman
ryankirkman / formatjson.js
Last active September 16, 2019 02:12 — forked from kristopherjohnson/formatjson.js
Read JSON from standard input and writes formatted JSON to standard output. Requires Node.js.
#!/usr/bin/env node
// Reads JSON from stdin and writes equivalent
// nicely-formatted JSON to stdout.
var input = '';
process.stdin.resume();
process.stdin.setEncoding('utf8');
server {
root /var/www/example.com/static;
server_name example.com;
access_log /var/log/nginx/example.com.access.log;
error_log /var/log/nginx/example.com.error.log;
try_files /maintenance.html @proxy;
location @proxy {
proxy_pass http://127.0.0.1:10001;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Linq.Expressions;
using System.Collections.ObjectModel;
using System.Reflection;
namespace Destrier
{
// You need to have the following installed:
// https://github.com/admc/wd
// https://github.com/kriskowal/q
// https://github.com/holidayextras/node-saucelabs
var wd = require('wd')
, Q = require('q')
, assert = require('assert')
, sauce = require('saucelabs')
, host = "ondemand.saucelabs.com"
// You need to have the following installed:
// https://github.com/admc/wd
// https://github.com/kriskowal/q
// https://github.com/holidayextras/node-saucelabs
var wd = require('wd')
, Q = require('q')
, assert = require('assert')
, sauce = require('saucelabs')
, host = "ondemand.saucelabs.com"
@ryankirkman
ryankirkman / index.md
Created March 16, 2012 04:02 — forked from lancejpollard/index.md
Math for Coders

Sets == Arrays of unique items

(A,B)

Ordered set.

[1, 2] != [2, 1]
import mmap
import sys
import struct
def main(in_file, out_file):
with open(in_file, "r+b") as f:
map = mmap.mmap(f.fileno(), 0)
data = map.readline()
# Assuming first char is \x00 and
# data is in blocks of 3.