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 mechanize | |
from xml.etree import cElementTree | |
USERNAME = '...' | |
PASSWORD = '...' | |
NUMBER = '2025551212' | |
br = mechanize.Browser() | |
br.open('https://ebillpay.verizonwireless.com/vzw/accountholder/overview/AccountOverview.action') |
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
### Install some packages. Ignore the errors. | |
aptitude install binutils libgdal1-1.5.0 postgresql-8.3-postgis postgresql-server-dev-8.3 python-psycopg2 python-setuptools | |
### Make connecting to postgres easier | |
echo "local all all trust" > /etc/postgresql/8.3/main/pg_hba.conf | |
invoke-rc.d postgresql-8.3 reload | |
### Become the Postgres user to create a spatial template database: |
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
class ExceptionUserInfoMiddleware(object): | |
""" | |
Adds user details to request context on receiving an exception, so that they show up in the error emails. | |
Add to settings.MIDDLEWARE_CLASSES and keep it outermost(i.e. on top if possible). This allows | |
it to catch exceptions in other middlewares as well. | |
""" | |
def process_exception(self, request, exception): | |
""" |
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
from types import MethodType | |
from django.http import CompatCookie, HttpRequest | |
def _set_cookie(self, key, value='', max_age=None, expires=None, path='/', | |
domain=None, secure=False): | |
self._resp_cookies[key] = value | |
self.COOKIES[key] = value | |
if max_age is not None: |
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
# create a file called .ssh/config | |
Host aliasname | |
HostName your.domain.name | |
User your_ssh_username | |
Port 1234 | |
# Example | |
Host web1 | |
HostName 192.168.2.122 |
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
# Open Terminal and paste in the following: | |
defaults write com.google.GmailNotifier AutocheckInterval 1 | |
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
To reset the data cache on your Mac’s hard drive, | |
sudo mdutil -E / | |
To force Spotlight to immediately start re-indexing your hard drive (this might take a few hours and is probably best left to run overnight), enter this command: | |
sudo mdutil -i on / |
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
FILE SPACING: | |
# double space a file | |
sed G | |
# double space a file which already has blank lines in it. Output file | |
# should contain no more than one blank line between lines of text. | |
sed '/^$/d;G' |
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 | |
# Argument = -t test -r server -p password -v | |
usage() | |
{ | |
cat << EOF | |
usage: $0 options | |
This script run the test1 or test2 over a machine. |
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/python -u | |
# | |
# c4lt - simple log lines colorer filter | |
# | |
# Copyright (C) 2011 Yaroslav Pogrebnyak <yyyaroslav@gmail.com> | |
# | |
# This program is free software: you can redistribute it and/or modify | |
# it under the terms of the GNU General Public License as published by | |
# the Free Software Foundation, either version 3 of the License, or | |
# (at your option) any later version. |