This file contains hidden or 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
from django.contrib import admin | |
from django.contrib.auth.admin import UserAdmin | |
from django.contrib.auth.models import User | |
class RestrictedUserAdmin(UserAdmin): | |
""" | |
Prevent permission escalation in when granting “user change” permissions | |
See: http://stackoverflow.com/a/2298268 | |
""" |
This file contains hidden or 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/sh | |
TOKEN="your-domain-api-token" | |
DOMAIN_ID="yourdomain.com" | |
RECORD_ID="12345" # Replace with the Record ID | |
IP="`curl http://jsonip.com | sed 's/{"ip":"\(.*\)"/\1/g' | sed 's/}//'`" | |
curl -H "Accept: application/json" \ | |
-H "Content-Type: application/json" \ | |
-H "X-DNSimple-Domain-Token: $TOKEN" \ |
This file contains hidden or 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
{% if site.github %} | |
<script> | |
if (window.location.hostname.indexOf('{{ site.github.pages_hostname }}') !== -1) { | |
window.location = '{{ site.github.url }}'; | |
} | |
</script> | |
{% endif %} |
This file contains hidden or 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
<!DOCTYPE html> | |
<title>Where am I?</title> | |
<h1>Where am I?</h1> | |
<select id="countries" name="countries"> | |
<option selected>----------</option> | |
<option value="AF">Afghanistan</option> | |
<option value="AL">Albania</option> | |
<option value="DZ">Algeria</option> | |
<option value="AS">American Samoa</option> | |
<option value="AD">Andorra</option> |
This file contains hidden or 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
// Includes functions for exporting active sheet or all sheets as JSON object (also Python object syntax compatible). | |
// Tweak the makePrettyJSON_ function to customize what kind of JSON to export. | |
var FORMAT_ONELINE = 'One-line'; | |
var FORMAT_MULTILINE = 'Multi-line'; | |
var FORMAT_PRETTY = 'Pretty'; | |
var LANGUAGE_JS = 'JavaScript'; | |
var LANGUAGE_PYTHON = 'Python'; |
This file contains hidden or 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
#!/usr/bin/env bash | |
# Install shc <http://www.datsi.fi.upm.es/~frosal/> on Ubuntu 14.04 | |
# Requires build-essential | |
if [ ! $(whoami) == "root" ]; then | |
echo "Please run as root!" | |
exit 1 | |
fi | |
# download shc package to be compiled |
This file contains hidden or 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/sh | |
echo "Content-type: text/html\n\n" | |
echo "<table>" | |
for user in $(ls -1 /home | egrep -v 'travis|ubuntu'); do | |
echo " | |
<tr> | |
<td valign=\"top\"><img src=\"/icons/folder.gif\" alt=\"[DIR]\"></td> | |
<td><a href=\"/~${user}/\">${user}</a></td> | |
</tr>" | |
done |
This file contains hidden or 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
#!/usr/bin/env python | |
# Adapted from http://joseph.is/1HPHiOE | |
import sys | |
import inspect | |
from datetime import datetime | |
from syslog import syslog, LOG_ERR | |
from area53 import route53 | |
from boto.route53.exception import DNSServerError |
This file contains hidden or 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/sh | |
hist=$(history | tail -1 | awk '{ print $1 }'); history -d $hist; history -d $(expr $hist - 1); unset hist |