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:
# How to add a field to the Django Admin Add User form | |
# using UserCreationForm. Add this to a admin.py and alter | |
# to whatever fields you'd like | |
from django.contrib.auth.forms import UserCreationForm | |
from django.contrib.auth.models import User | |
from django.contrib.auth.admin import UserAdmin | |
from django import forms | |
from django.utils.translation import ugettext_lazy as _ | |
from django.contrib import admin |
<?php | |
/** | |
* This is free and unencumbered software released into the public domain. | |
* | |
* Anyone is free to copy, modify, publish, use, compile, sell, or | |
* distribute this software, either in source code form or as a compiled | |
* binary, for any purpose, commercial or non-commercial, and by any | |
* means. | |
* |
#!/bin/bash | |
# Shell script to backup MySQL database | |
# Set these variables | |
MyUSER="" # DB_USERNAME | |
MyPASS="" # DB_PASSWORD | |
MyHOST="" # DB_HOSTNAME | |
# Backup Dest directory | |
DEST="" # /home/username/backups/DB |
// 100-score solution for http://codility.com/demo/take-sample-test/ | |
function equi(array) { | |
var i, | |
len = array.length, | |
sum = 0, | |
leftSum = 0, | |
rightSum; | |
for (i = 0; i < len; i++) { |
As configured in my dotfiles.
start new:
tmux
start new with session name:
worker_processes 1; | |
error_log logs/error.log; | |
events { | |
worker_connections 1024; | |
} |
<?php | |
//Drop-in replacement for PHP's SoapClient class supporting connect and response/transfer timeout | |
//Usage: Exactly as PHP's SoapClient class, except that 3 new options are available: | |
// timeout The response/transfer timeout in milliseconds; 0 == default SoapClient / CURL timeout | |
// connecttimeout The connection timeout; 0 == default SoapClient / CURL timeout | |
// sslverifypeer FALSE to stop SoapClient from verifying the peer's certificate | |
class SoapClientTimeout extends SoapClient | |
{ | |
private $timeout = 0; | |
private $connecttimeout = 0; |
<?php | |
ini_set("error_reporting", E_ALL & ~E_NOTICE); | |
?> | |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | |
<html xmlns="http://www.w3.org/1999/xhtml"> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | |
<title>Genetic Algorithm : TSP : PHP Implementation by Thomas Hunter</title> | |
<style> | |
body { |
// Long Polling (Recommened Technique - Creates An Open Connection To Server ∴ Fast) | |
(function poll(){ | |
$.ajax({ url: "server", success: function(data){ | |
//Update your dashboard gauge | |
salesGauge.setValue(data.value); | |
}, dataType: "json", complete: poll, timeout: 30000 }); | |
})(); |