------------------------------- ------------------ Django -------------------- | Browser: GET /udo/contact/2 | === wsgi/fcgi ===> | 1. Asks OS for DJANGO_SETTINGS_MODULE | ------------------------------- | 2. Build Request (from wsgi/fcgi callback) | | 3. Get settings.ROOT_URLCONF module | | 4. Resolve URL/view from request.path | # url(r'^udo/contact/(?P<id>\w+)', view, name='url-identifier') | 5. Apply request middlewares | # settings.MIDDLEWARE_CLASSES
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
# Modify this file accordingly for your specific requirement. | |
# http://www.thegeekstuff.com | |
# 1. Delete all existing rules | |
iptables -F | |
# 2. Set default chain policies | |
iptables -P INPUT DROP | |
iptables -P FORWARD DROP | |
iptables -P OUTPUT DROP |
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
//Results from running test/jsdom/leak.js on brianmcd's fork of JSDOM which uses Contextify. | |
node --trace-gc leak.js | |
Scavenge 2.6 -> 2.3 MB, 1 ms. | |
Mark-sweep 3.5 -> 2.8 MB, 3 ms. | |
Scavenge 4.4 -> 3.9 MB, 0 ms. | |
Scavenge 5.9 -> 5.0 MB, 1 ms. | |
Mark-sweep 7.0 -> 4.8 MB, 10 ms. | |
Mark-sweep 8.7 -> 7.2 MB, 10 ms. | |
Mark-sweep 14.2 -> 9.8 MB, 16 ms. |
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
try: | |
from django.utils.deprecation import MiddlewareMixin | |
except ImportError: | |
MiddlewareMixin = object | |
class ForceDefaultLanguageMiddleware(MiddlewareMixin): | |
""" | |
Ignore Accept-Language HTTP headers | |
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
var Module = require('module'); | |
var vm = require('vm'); | |
var path = require('path'); | |
var filename = process.cwd() + '/lib/eval.js'; | |
var mod = new Module(filename); | |
var context = { | |
module: mod, | |
__filename: filename, |
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
Latency Comparison Numbers (~2012) | |
---------------------------------- | |
L1 cache reference 0.5 ns | |
Branch mispredict 5 ns | |
L2 cache reference 7 ns 14x L1 cache | |
Mutex lock/unlock 25 ns | |
Main memory reference 100 ns 20x L2 cache, 200x L1 cache | |
Compress 1K bytes with Zippy 3,000 ns 3 us | |
Send 1K bytes over 1 Gbps network 10,000 ns 10 us | |
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD |
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
--[[ | |
Currently implemented functions are: | |
login(user, passwd) | |
me(auth) | |
submit(title, isSelf, content, subreddit, auth) | |
comment(thing_id, text, auth) | |
]] | |
local json = require "json" | |
local util = require "reddit.util" |
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
{-# LANGUAGE OverloadedStrings, RankNTypes, KindSignatures, FlexibleContexts #-} | |
module Plugins.NotificationDaemon where | |
-- xmobar plugin API | |
import Plugins | |
import DBus.Bus | |
import DBus.Client | |
import DBus.Constants |
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
''' | |
adminreverse from here http://djangosnippets.org/snippets/2032/ | |
changed for working with ForeignKeys | |
''' | |
''' | |
reverseadmin | |
============ | |
Module that makes django admin handle OneToOneFields in a better way. | |
A common use case for one-to-one relationships is to "embed" a model |
OlderNewer