Get a VPS that offers 2 or more IP addresses.
From the WHM cPanel, find the menu item Service Configuration
, select Apache Configuration
and then click on Reserved IPs Editor
.
class YourResource(ModelResource): | |
def wrap_view(self, view): | |
""" | |
Wraps views to return custom error codes instead of generic 500's | |
""" | |
@csrf_exempt | |
def wrapper(request, *args, **kwargs): | |
try: |
#!/bin/bash | |
EXCLUDEDIR=${EXCLUDEDIR:-"env/*"} | |
COLOR=${COLOR:-always} | |
CONTEXT=${CONTEXT:-0} | |
grep -IiRn --exclude="$EXCLUDE" --exclude-dir="$EXCLUDEDIR" --color=$COLOR -C$CONTEXT "$1" * \ | |
| less -iFRX |
#! /usr/bin/env python | |
import redis | |
import random | |
import pylibmc | |
import sys | |
r = redis.Redis(host = 'localhost', port = 6389) | |
mc = pylibmc.Client(['localhost:11222']) |
$('#selectJob').children().hide(); | |
var sel_list = $('<div id="jobDropdown"><strong class="cta"><span></span></strong><ul></ul></div>'); | |
sel_list.find('span').text($('#selectJob label').text()); | |
$('#selectJob select').children('option').each(function(){ | |
sel_list.children('ul').append('<li>' + $(this).text() + '</li>'); | |
}); | |
$('#selectJob').append(sel_list); | |
$('#jobDropdown').find('li').live('click',function(e){ | |
$('#selectJob select option').eq($(this).index()).attr('selected','selected').siblings('option').removeAttr('selected'); | |
$(this).addClass('selected'); |
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 |
The [RFC for a new simple to use password hashing API][rfc] has just been accepted for PHP 5.5. As the RFC itself is rather technical and most of the sample codes are something you should not use, I want to give a very quick overview of the new API:
Everybody knows that you should be hashing their passwords using bcrypt, but still a surprising number of developers uses insecure md5 or sha1 hashes (just look at the recent password leaks). One of the reasons for this is that the crypt() API is ridiculously hard to use and very prone to programming mistakes.
class CORSResource(object): | |
""" | |
Adds CORS headers to resources that subclass this. | |
""" | |
def create_response(self, *args, **kwargs): | |
response = super(CORSResource, self).create_response(*args, **kwargs) | |
response['Access-Control-Allow-Origin'] = '*' | |
response['Access-Control-Allow-Headers'] = 'Content-Type' | |
return response |
#!/usr/bin/env bash | |
branch=`git branch -a | egrep -io "([^/]+/)?[^/]+$1$" | sed 's/* //' | head -1` | |
git checkout $branch |