--- a/content/projects/django-hoptoad.html Fri Jan 15 19:52:47 2010 -0500
+++ b/content/projects/django-hoptoad.html Fri Jan 15 20:04:42 2010 -0500
@@ -40,14 +40,17 @@
Grab the the django-hoptoad code by cloning the [Mercurial][] repository (or
just [download the latest version][tip-dl] and unzip it somewhere):
+ :::text
hg clone http://bitbucket.org/sjl/django-hoptoad/
There's a git mirror too if you *really* want it.
+ :::text
git clone git://github.com/sjl/django-hoptoad.git
Once you download it, you can install it in the usual manner:
+ :::text
cd django-hoptoad
python setup.py install
@@ -55,10 +58,12 @@
Mercurial or git, you can symlink the module into your `site-packages`
directory instead of using `python setup.py install`:
+ :::text
ln -s /full/path/to/django-hoptoad/hoptoad /full/path/to/site-packages/
To make sure it works you can run:
+ :::text
python -c 'import hoptoad'
[Mercurial]: {{links.mercurial}}
@@ -73,6 +78,7 @@
First, add the `HoptoadNotifierMiddleware` as the last item in your
`MIDDLEWARE_CLASSES` setting:
+ :::python
MIDDLEWARE_CLASSES = (
# ... other middleware classes ...
'hoptoad.middleware.HoptoadNotifierMiddleware',
@@ -81,6 +87,7 @@
Next, you'll need to add a `HOPTOAD_API_KEY` setting. You can get the key from
the Hoptoad project page.
+ :::python
HOPTOAD_API_KEY = 'Your Hoptoad API key.'
Optional Settings
@@ -97,6 +104,7 @@
it in Hoptoad too. If you want to always notify Hoptoad of errors, even while
in `DEBUG` mode, add the following setting:
+ :::python
HOPTOAD_NOTIFY_WHILE_DEBUG = True
### Specify a Default Timeout
@@ -112,6 +120,7 @@
If you'd like to change that amount you can use the `HOPTOAD_TIMEOUT` setting.
You **must** be running Python 2.6+ to use this.
+ :::python
HOPTOAD_TIMEOUT = 5
The number is the number of seconds the notifier will wait before timing out.
@@ -124,6 +133,7 @@
By default Hoptoad will **not** be notified of 404 (page not found) errors. If
you'd like to change this you'll need to add the following setting:
+ :::python
HOPTOAD_NOTIFY_404 = True
**IMPORTANT**: If you are using Django's `flatpages` app and want to track 404
@@ -134,6 +144,7 @@
To track 404s while using the `flatpages` app your `MIDDLEWARE_CLASSES`
setting should look like this:
+ :::python
MIDDLEWARE_CLASSES = (
# ... other middleware classes ...
'hoptoad.middleware.HoptoadNotifierMiddleware',
@@ -150,6 +161,7 @@
By default Hoptoad will **not** be notified of 403 (forbidden) errors. If
you'd like to change this you'll need to add the following setting:
+ :::python
HOPTOAD_NOTIFY_403 = True
Note:
@@ -162,6 +174,7 @@
If you'd like to ignore all errors from certain User Agents you can use the
following setting:
+ :::python
HOPTOAD_IGNORE_AGENTS = ['MSIE 6.0', 'Trident']
If any of the strings in the list appear *anywhere* in the User Agent string,
@@ -170,6 +183,7 @@
The strings are actually regular expressions, so you can be more specific if
you like:
+ :::python
HOPTOAD_IGNORE_AGENTS = [r'^Mozilla.*compatible; MSIE \d+\.\d+.*$']
One thing this is useful for (aside from hating on IE) is ignoring errors from
@@ -178,6 +192,7 @@
This would probably be a good starting point for ignoring crawlers:
+ :::python
HOPTOAD_IGNORE_AGENTS = ['Googlebot', 'Yahoo! Slurp', 'YahooSeeker']
Troubleshooting
@@ -187,6 +202,7 @@
they can determine what's wrong. To enable the tests you'll need to add
django-hoptoad to your `INSTALLED_APPS` setting:
+ :::python
INSTALLED_APPS = (
# ... other apps ...
'hoptoad',
@@ -195,6 +211,7 @@
Once you've done that you can run the unit tests:
+ :::text
python manage.py test hoptoad
**NOTE**: The unit tests are very simple at the moment. I'm working on more,
--- a/content/projects/grabtweets.html Fri Jan 15 19:52:47 2010 -0500
+++ b/content/projects/grabtweets.html Fri Jan 15 20:04:42 2010 -0500
@@ -24,6 +24,7 @@
To install it, you can [download][] the latest version, or clone the Mercurial
repository:
+ :::text
hg clone http://bitbucket.org/sjl/grabtweets/
You can put it anywhere you like.
@@ -38,6 +39,7 @@
To back up your tweets, run `grabtweets` like this:
+ :::console
$ grabtweets.py -u USERNAME FILE
`grabtweets` will pull down the 200 newest tweets from USERNAME and store them in FILE.
@@ -57,6 +59,7 @@
To print the tweets that `grabtweets` has already backed up, run it like this:
+ :::console
$ grabtweets.py -p FILE
[Python]: {{links.python}}
--- a/content/projects/hg-paste.html Fri Jan 15 19:52:47 2010 -0500
+++ b/content/projects/hg-paste.html Fri Jan 15 20:04:42 2010 -0500
@@ -27,10 +27,12 @@
Clone the repository:
+ :::text
hg clone http://bitbucket.org/sjl/hg-paste/
Edit the `[extensions]` section in your `~/.hgrc` file:
+ :::ini
[extensions]
paste = (path to)/hg-paste/paste.py
@@ -39,20 +41,24 @@
To paste a diff of all uncommitted changes in the working directory:
+ :::text
hg paste
To paste the changes that revision `REV` made:
+ :::text
hg paste -r REV
To paste the changes between revisions `REV1` and `REV2`:
+ :::text
hg paste -r REV1:REV2
If any files are specified only those files will be included in the diffs.
Several options can be used to specify more metadata about the paste:
+ :::text
hg paste --user Steve --title 'Progress on feature X' --keep
The pastebin website to use can be specified with `--dest`. Currently only
--- a/content/projects/hg-prompt.html Fri Jan 15 19:52:47 2010 -0500
+++ b/content/projects/hg-prompt.html Fri Jan 15 20:04:42 2010 -0500
@@ -33,7 +33,7 @@
Edit the `[extensions]` section in your `~/.hgrc` file:
- :::text
+ :::ini
[extensions]
prompt = (path to)/hg-prompt/prompt.py
--- a/content/projects/hgtab.html Fri Jan 15 19:52:47 2010 -0500
+++ b/content/projects/hgtab.html Fri Jan 15 20:04:42 2010 -0500
@@ -31,28 +31,32 @@
### OPTION 1: Easy, Ugly
-Copy the contents of hgtab-bash.sh into your ~/.bashrc file.
+Copy the contents of `hgtab-bash.sh` into your `~/.bashrc` file.
### OPTION 2: Harder, Less Ugly
-Download hgtab-bash.sh and place the following line somewhere in your
-~/.bashrc file:
+Download `hgtab-bash.sh` and place the following line somewhere in your
+`~/.bashrc` file:
+ :::bash
source ~/path/to/hgtab/hgtab-bash.sh
### OPTION 3: Hardest, Elegant
Clone this repository somewhere with this command:
+ :::text
hg clone http://bitbucket.org/sjl/hgtab/
-Add the following line to your ~/.bashrc file:
+Add the following line to your `~/.bashrc` file:
+ :::bash
source ~/path/to/hgtab/hgtab-bash.sh
If you use this method you can update the file by pulling down the changes
from this repository:
+ :::text
cd ~/path/to/hgtab
hg pull
@@ -61,7 +65,7 @@
Once hgtab is sourced it'll add some nifty tab completion features in your
shell. For example, you can tab complete Mercurial commands:
- #!console
+ :::console
sjl at grendel in test $ hg re<tab(s)>
recover remove rename resolve revert
sjl at grendel in test $ hg re
@@ -69,7 +73,7 @@
When you're using a command that wants a revision as a parameter, hitting tab
will complete on tags (and bookmarks) and branches.
- #!console
+ :::console
sjl at grendel in test $ hg branches
blue 20:f05ca6eb51a1
red 16:8262f0345f41 (inactive)
@@ -94,7 +98,7 @@
It will also complete remote paths when you're pushing or pulling.
- #!console
+ :::console
sjl at grendel in test $ hg paths
alice-dev = http://alice-dev
alice-stable = http://alice-stable
--- a/content/projects/t.html Fri Jan 15 19:52:47 2010 -0500
+++ b/content/projects/t.html Fri Jan 15 20:04:42 2010 -0500
@@ -96,11 +96,13 @@
Next, decide where you want to keep your todo lists. I put mine in `~/tasks`.
Create that directory:
+ :::text
mkdir ~/tasks
Finally, set up an alias to run `t`. Put something like this in your
`~/.bashrc` file:
+ :::bash
alias t='python ~/path/to/t.py --task-dir ~/tasks --list tasks'
Make sure you run `source ~/.bashrc` or restart your terminal window to make
@@ -115,6 +117,7 @@
To add a task, use `t [task description]`:
+ :::console
$ t Clean the apartment.
$ t Write chapter 10 of the novel.
$ t Buy more beer.
@@ -124,6 +127,7 @@
Listing your tasks is even easier -- just use `t`:
+ :::console
$ t
9 - Buy more beer.
30 - Clean the apartment.
@@ -136,6 +140,7 @@
After you're done with something, use `t -f ID` to finish it:
+ :::console
$ t -f 31
$ t
9 - Buy more beer.
@@ -147,6 +152,7 @@
Sometimes you might want to change the wording of a task. You can use `t -e ID
[new description]` to do that:
+ :::console
$ t -e 30 Clean the entire apartment.
$ t
9 - Buy more beer.
@@ -155,6 +161,7 @@
Yes, nerds, you can use sed-style substitution strings:
+ :::console
$ t -e 9 /more/a lot more/
$ t
9 - Buy a lot more beer.
@@ -170,6 +177,7 @@
Counting your tasks is simple using the `wc` program:
+ :::console
$ t | wc -l
2
$
@@ -178,10 +186,12 @@
Want a count of your tasks right in your prompt? Edit your `~/.bashrc` file:
+ :::bash
export PS1="[$(t | wc -l | sed -e's/ *//')] $PS1"
Now you've got a prompt that looks something like this:
+ :::console
[2] $ t -f 30
[1] $ t Feed the cat.
[2] $
@@ -192,6 +202,7 @@
sometimes it's useful to be able to have at least *one* level of organization.
To split up your tasks into different lists you can add a few more aliases:
+ :::bash
alias g='python ~/path/to/t.py --task-dir ~/tasks --list groceries'
alias m='python ~/path/to/t.py --task-dir ~/tasks --list music-to-buy'
alias w='python ~/path/to/t.py --task-dir ~/tasks --list wines-to-try'
@@ -203,6 +214,7 @@
Add another alias to your `~/.bashrc` file:
+ :::bash
alias b='python ~/path/to/t.py --task-dir . --list bugs'
Now when you're in your project directory you can use `b` to manage the list