Skip to content

Instantly share code, notes, and snippets.

@jacobwegner
jacobwegner / keybase.md
Created January 19, 2021 16:23
Keybase Verification Gist

Keybase proof

I hereby claim:

  • I am jacobwegner on github.
  • I am jacobwegner (https://keybase.io/jacobwegner) on keybase.
  • I have a public key ASCciVOElstU9_kpv8tenXJ31IHnMevcAKLI4sqNg96ifwo

To claim this, I am signing this object:

@jacobwegner
jacobwegner / data-recovery-README.md
Last active January 30, 2024 06:29
Recovering data deleted via the Django admin

I was looking for a way to revert data deleted by mistake from the Django admin.

I reverse-engineered how Django's admin builds the list of objects displayed on the "Are you sure?" confirmation page.

Given a single obj or list of objs, the script included in this gist will:

  • Use the NestedObjects utility to determine the objects that would be deleted
  • Pass those objects to Django's JSON serializer
  • Write the objects to adeleted-objects fixture
@jacobwegner
jacobwegner / root_domain.py
Last active January 28, 2016 00:02
Django Middleware to redirect to a root domain
import re
from django import http
from django.utils import six
from django.utils.http import urlquote
WWW_PATTERN = re.compile(r"www\.")
@jacobwegner
jacobwegner / atom-packages.cfg
Last active October 17, 2015 19:19 — forked from damiankloip/atom-extra.cfg
Atom custom configuration
[application]
name = Atom packages
[configuration_files]
.atom/packages.list
; install by copying this file into
; ~/.mackup/atom-packages.cfg
; export packages from atom via
@jacobwegner
jacobwegner / tn_zip_codes.csv
Created May 16, 2012 13:07
Tennessee Zip Codes
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
37995
37010
38310
37033
37616
38001
37701
37012
38501
38504
State Postal Code
Alabama AL
Alaska AK
Arizona AZ
Arkansas AR
California CA
Colorado CO
Connecticut CT
Delaware DE
Florida FL
{ "10500" : { "Corrective Action" : "Occurs when you have not agreed to the billing agreement.",
"Error Code" : "10500",
"Long Message" : "This transaction cannot be processed due to an invalid merchant configuration.",
"Short Message" : "Invalid Configuration"
},
"10501" : { "Corrective Action" : "Occurs when the billing agreement is disabled or inactive.",
"Error Code" : "10501",
"Long Message" : "This transaction cannot be processed due to an invalid merchant configuration.",
"Short Message" : "Invalid Configuration"
},
# after the local_settings import
BROKER_TRANSPORT = "redis"
BROKER_HOST = GONDOR_REDIS_HOST
BROKER_PORT = GONDOR_REDIS_PORT
BROKER_VHOST = "0"
BROKER_PASSWORD = GONDOR_REDIS_PASSWORD
CELERY_RESULT_BACKEND = "redis"
CELERY_REDIS_HOST = GONDOR_REDIS_HOST