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
<?php | |
// See: http://blog.ircmaxell.com/2013/02/preventing-csrf-attacks.html | |
// Start a session (which should use cookies over HTTP only). | |
session_start(); | |
// Create a new CSRF token. | |
if (! isset($_SESSION['csrf_token'])) { | |
$_SESSION['csrf_token'] = base64_encode(openssl_random_pseudo_bytes(32)); | |
} |
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
# get this: https://github.com/jedie/python-ping.git | |
import os | |
import string | |
from time import time, sleep | |
from ping import Ping | |
class QuietPing(Ping): | |
def print_failed(self): |
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
#!/bin/bash | |
# A lighter graphite for raspberry pi/raspbian wheezy. | |
# For when you don't need memcache/rabbitmq/full uWSGI server/etc | |
# Not fully tested on a clean install. This is just what it *should* take. | |
# Installing supervisor because upstart conflicts with sysvinit | |
aptitude update && aptitude install gcc python-dev python-pip python-cairo python-pysqlite2 supervisor | |
pip install django==1.4.3 |
Using JSON in Postgres by example.
- Download and install: Docker Toolbox
- Open Docker Quickstart Terminal
- Start a new postgres container:
docker run --name my-postgres -e POSTGRES_PASSWORD=mysecretpassword -d postgres
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
import datetime | |
import logging | |
import os | |
import re | |
import constants | |
log_separator = "\n====================================================================================================" | |