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.
| Initially wanted to do this: | |
| from django.core.cache.backends.memcached import CacheClass | |
| class DeletableCache(object): | |
| """ | |
| The memcache library doesnt seem to support delete. This is a mixin to fake it. | |
| # if we are using port 443 and the url doesnt contain onlinebooking or media-server then redirect to http. | |
| RewriteCond %{SERVER_PORT} ^443$ | |
| RewriteCond %{REQUEST_URI} !(onlinebooking) | |
| RewriteCond %{REQUEST_URI} !(media-server) | |
| RewriteRule ^(.*)$ http://test.gapadventures.com$1 [R=301,L] | |
| # if not using port 443 and url contains onlinebooking, redirect to https | |
| # Redirect to HTTPS server. |
| # Hey coops.. | |
| # | |
| # Imagine yourself on the other side of the table: two job openings, hundreds of resumes, | |
| # _all of which_ look friggin' identical. Yeah, the HR departments at your MegaCorp XYZ are using | |
| # automated tools to scan for keywords, and the coop department at your school is trying to beat | |
| # you into submission to follow some "predefined template".. But, unless what you're aspiring to | |
| # is to be an automaton at MegaCorp XYZ, relegated to writing test harnesses for code that will | |
| # never see the light of day.. please do yourself a favor, and _be different_! Be bold, dammit. | |
| # | |
| # (Frankly, I'm falling asleep while reading your resumes.. Wake me up! Srsly.) |
| $('.required_field').each(function(){ | |
| $("label[for='" + $(this).attr("id") + "']").attr('class', 'required'); | |
| }); |
| /* | |
| * A simple Google maps Javascript widget which will display a map and | |
| * a marker with the ability to move the marker, then setting the | |
| * lat/lng of the marker into the specified (or default) fields. | |
| */ | |
| var google_map_location = new function() { | |
| var jQuery; | |
| var init_options; | |
| var geocoder; |
| In models.py | |
| -------------------- | |
| from datetime import datetime | |
| from django.db import models | |
| from django.contrib.sites.models import Site | |
| from django.contrib.contenttypes.models import ContentType | |
| from django.contrib.contenttypes import generic | |
| class Cart(models.Model): |
| ctrl-z | |
| bg | |
| touch /tmp/stdout | |
| touch /tmp/stderr | |
| gdb -p $! | |
| # In GDB | |
| p dup2(open("/tmp/stdout", 1), 1) | |
| p dup2(open("/tmp/stderr", 1), 2) |
| from django.core import serializers | |
| from yourapp.models import YourModel | |
| data = serializers.serialize("json", YourModel.objects.all(), indent = 4) | |
| f = open('path/to/file', 'w') | |
| f.write(data) | |
| f.close() |
| #!/usr/bin/env python | |
| """ | |
| Use pip to get a list of local packages to check against one or more package | |
| indexes for updated versions. | |
| """ | |
| import pip | |
| import sys, xmlrpclib | |
| from cStringIO import StringIO | |
| from distutils.version import StrictVersion, LooseVersion |