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
def search(request): | |
search_string=request.POST['search_string'] | |
if re.match(r'^\s*$',search_string): return redirect('home') | |
results=[] | |
search_fields=('id','name') | |
equipment_models = \ | |
[model for model in django.db.models.get_models() if\ | |
model._meta.db_table.startswith("equipment_")] | |
for model in equipment_models: | |
query=halipsearch.get_query(search_string,search_fields) |
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
# LDAP Remote User Backend for Django 1.3 | |
# Hugh Saunders - [email protected] | |
# Written for the Surgical Materials Testing Laboratory - http://smtl.co.uk | |
# 2011 | |
from django.contrib.auth.backends import RemoteUserBackend | |
import settings as s | |
import ldap | |
class LDAPRemoteUserBackend(RemoteUserBackend): |
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
{%extends "admin/base.html" %} | |
{% block extrahead %} | |
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js"></script> | |
<script> | |
$(document).ready(function(){ | |
$('.add-another').each(function(i,o){ | |
select_obj=$(o).parent().find('select')[0]; | |
item_id=select_obj.options[select_obj.selectedIndex].value; |
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
#!/usr/bin/env python | |
# HuntGroupReminder - Hugh Saunders 2011 | |
# This is probably the most annoying program ever. | |
# It pops up a window before and after screen locking in order to remind me to login/logout of my desk phone. | |
# Actually, I couldn't figure out how to show a window before screen lock, so you have to call this program instead of locking the screen. | |
# This script will initiate screen lock via dbus once the initial window has been shown, it then subscribes to a dbus signal so it is notified | |
# when the screen is unlocked | |
# To use this in ubuntu: goto system > preferences > keyboard shortcuts. |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
hms:~ hms$ airport -s | |
SSID BSSID RSSI CHANNEL HT CC SECURITY (auth/unicast/group) | |
BTHomeHub2-M42K 00:24:17:de:50:21 -55 1 N -- WPA(PSK/AES,TKIP/TKIP) WPA2(PSK/AES,TKIP/TKIP) | |
BTOpenzone-H 02:24:17:de:50:22 -55 1 N -- NONE | |
storrier 00:26:44:90:0d:0b -39 1 Y -- WPA(PSK/TKIP/TKIP) WPA2(PSK/AES/TKIP) | |
BTFON 02:24:17:de:50:23 -55 1 N -- NONE | |
BTOpenzone-H 02:24:17:f1:e9:a8 -68 1 Y -- NONE | |
BTFON 02:24:17:f1:e9:a9 -68 1 Y -- NONE | |
BTHomeHub2-G2CH 00:24:17:f1:e9:a7 -67 1 Y -- WPA(PSK/AES,TKIP/TKIP) WPA2(PSK/AES,TKIP/TKIP) | |
SKY02133 00:24:b2:f7:3b:06 -85 6 N -- WPA(PSK/TKIP/TKIP) |
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 re | |
from django import template | |
register=template.Library() | |
class PropertyListNode(template.Node): | |
def __init__(self,model_string,format_spec): | |
self.model_string=model_string | |
self.format_spec=format_spec | |
def render(self,context): |
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
Scripts: | |
* setup.py creates cloud instances,installs and starts jmeter-server | |
* cleanup.py destroys cloud instances who's name matches a pattern | |
Usage: | |
1) edit setup.py, and insert your username/api key/ssh keys. Define the number of instances you want | |
1a) install the dependencies listed at the top of setup.py | |
2) run setup.py | |
3) edit jmeter.properties and add the line specified at the end of setup.py's output | |
4) run jmeter, build a test plan, and start on all remotes. |
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
#munin plugin configuration, on debian this goes in /etc/munin/plugin-conf.d/ | |
[orange] | |
timeout 240 | |
env.owuser YOUR-PHONENUMBER-HERE | |
env.owpass YOUR-PASSWORD-HERE |
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
#clone the repository from github | |
hugh@pond-ng:~/git$ git clone https://github.com/rackspace/python-clouddns.git | |
Cloning into 'python-clouddns'... | |
remote: Counting objects: 208, done. | |
remote: Compressing objects: 100% (102/102), done. | |
remote: Total 208 (delta 124), reused 185 (delta 104) | |
Receiving objects: 100% (208/208), 38.14 KiB, done. | |
Resolving deltas: 100% (124/124), done. | |
hugh@pond-ng:~/git$ ls |
OlderNewer