For excessively paranoid client authentication.
Updated Apr 5 2019:
because this is a gist from 2011 that people stumble into and maybe you should AES instead of 3DES in the year of our lord 2019.
some other notes:
#!/bin/bash | |
# | |
# DESCRIPTION: | |
# | |
# Set the bash prompt according to: | |
# * the active virtualenv | |
# * the branch/status of the current git repository | |
# * the return value of the previous command | |
# * the fact you just came from Windows and are used to having newlines in | |
# your prompts. |
// snippet taken from http://catapulty.tumblr.com/post/8303749793/heroku-and-node-js-how-to-get-the-client-ip-address | |
function getClientIp(req) { | |
var ipAddress; | |
// The request may be forwarded from local web server. | |
var forwardedIpsStr = req.header('x-forwarded-for'); | |
if (forwardedIpsStr) { | |
// 'x-forwarded-for' header may return multiple IP addresses in | |
// the format: "client IP, proxy 1 IP, proxy 2 IP" so take the | |
// the first one | |
var forwardedIps = forwardedIpsStr.split(','); |
<script type="text/javascript"> | |
// First let's create an array of JavaScript Date | |
// objects. | |
// More info about the Date class: | |
// http://w3schools.com/js/js_obj_date.asp | |
var dates = [ | |
new Date(2010, 4, 10, 10, 07, 16), | |
new Date(2010, 4, 8, 9, 16, 09), | |
new Date(2010, 3, 30, 0, 15, 49), |
<?php | |
$html = file_get_contents("http://example.com/product/42"); | |
$context = stream_context_create(array( | |
"http" => array( | |
"method" => "POST", | |
"header" => "Content-Type: multipart/form-data; boundary=--foo\r\n", | |
"content" => "--foo\r\n" | |
. "Content-Disposition: form-data; name=\"myFile\"; filename=\"image.jpg\"\r\n" | |
. "Content-Type: image/jpeg\r\n\r\n" |
from __future__ import with_statement | |
from fabric.api import env | |
from fabric.api import * | |
from fabric.contrib.console import confirm | |
from fabric.contrib.project import upload_project | |
import ubuntu | |
import protobuf | |
from geopy import units, distance | |
from mezzanine.core.managers import CurrentSiteManager | |
class GeoManager(CurrentSiteManager): | |
def near(self, latitude=None, longitude=None, distance_range=30): | |
queryset = super(GeoManager, self).get_query_set() | |
if not (latitude and longitude and distance_range): | |
return queryset.none() |
<?php | |
/** | |
* Extended Walker class for use with the | |
* Twitter Bootstrap toolkit Dropdown menus in Wordpress. | |
* Edited to support n-levels submenu. | |
* @author johnmegahan https://gist.github.com/1597994, Emanuele 'Tex' Tessore https://gist.github.com/3765640 | |
* @license CC BY 4.0 https://creativecommons.org/licenses/by/4.0/ | |
*/ | |
class BootstrapNavMenuWalker extends Walker_Nav_Menu { |