The official and authoritative source for this document has moved. Please update your bookmarks.
You can still use the comments at the bottom of the page to register comments even for the new official location.
The official and authoritative source for this document has moved. Please update your bookmarks.
You can still use the comments at the bottom of the page to register comments even for the new official location.
| #!/bin/bash | |
| # | |
| # Show replication lag for one or more postgresql slaves in streaming replication. | |
| # | |
| # [email protected] | |
| # 2012-01-09 | |
| # | |
| psql="which psql" | |
| psql_extra_opts="" |
| #!/etc/init/carbon-cache.conf | |
| description "Carbon server" | |
| start on filesystem or runlevel [2345] | |
| stop on runlevel [!2345] | |
| umask 022 | |
| expect fork | |
| respawn |
This gist has been migrated to a real repository: https://github.com/wolever/pip2pi
| Key was generated using: | |
| tom% openssl genrsa -des3 -out example.com.key 2048 | |
| Generating RSA private key, 2048 bit long modulus | |
| ....+++ | |
| ..........................................................................................................................+++ | |
| e is 65537 (0x10001) | |
| Enter pass phrase for example.com.key: | |
| Verifying - Enter pass phrase for example.com.key: | |
| %tom |
| :+1: | |
| :-1: | |
| :airplane: | |
| :art: | |
| :bear: | |
| :beer: | |
| :bike: | |
| :bomb: | |
| :book: | |
| :bulb: |
| $(document).bind('ajaxError', function(e, jqXHR){ | |
| if (jqXHR.status == 500){ | |
| var erframe = document.createElement('iframe'); | |
| $('body').append(erframe); | |
| $(erframe).css({ | |
| 'position': 'absolute', | |
| 'top': '5%', 'left': '50%', | |
| 'width': '90%', 'height': '90%', | |
| 'marginLeft': '-45%' | |
| }).attr('id', 'errorframe'); |
| from django.db import models | |
| from django.db.models import signals | |
| class DeletingFileField(models.FileField): | |
| """ | |
| FileField subclass that deletes the refernced file when the model object | |
| itself is deleted. | |
| WARNING: Be careful using this class - it can cause data loss! This class | |
| makes at attempt to see if the file's referenced elsewhere, but it can get |
| var Parser = require('./jsonparse'); | |
| var Http = require('http'); | |
| var p = new Parser(); | |
| // IMPORTANT, put your username and password in here | |
| var username = "yourTwitterUsername", password = "yourPassword"; | |
| var client = Http.createClient(80, "stream.twitter.com"); | |
| var request = client.request("GET", "/1/statuses/sample.json", { | |
| "Host": "stream.twitter.com", | |
| "Authorization": (new Buffer(username + ":" + password)).toString("base64") | |
| }); |
| from functools import wraps | |
| def patch_objects_get(cls): | |
| """ Patch 'cls.objects.get' so its DoesNotExist errors will be more | |
| helpful. | |
| Usage: | |
| >>> @patch_objects_get | |
| ... class MyModel(m.Model): |