PDFs support incremental updates — each time a PDF is saved, a new
cross-reference (xref) section is appended, creating a new "version" while
preserving all prior versions. MuPDF already tracks these versions internally
and has a public pdf_count_versions() function, but there's no public way to
select a version so that all subsequent API calls operate on that historical
snapshot.
This file contains hidden or 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 time | |
| from functools import wraps | |
| from typing import Callable, Type | |
| def retry( | |
| ExceptionToCheck: Type[Exception], | |
| tries: int = 4, | |
| delay: float = 3, | |
| backoff: float = 2, |
This file contains hidden or 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
| WITH table_scans as ( | |
| SELECT relid, | |
| tables.idx_scan + tables.seq_scan as all_scans, | |
| ( tables.n_tup_ins + tables.n_tup_upd + tables.n_tup_del ) as writes, | |
| pg_relation_size(relid) as table_size | |
| FROM pg_stat_user_tables as tables | |
| ), | |
| all_writes as ( | |
| SELECT sum(writes) as total_writes | |
| FROM table_scans |
This file contains hidden or 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
| // ==UserScript== | |
| // @name Jureeka | |
| // @namespace http://www.jureeka.org | |
| // @description Turns legal citations in webpages into hyperlinks that direct you to online legal source material. | |
| // ==/UserScript== | |
| // $Id: jureeka.js 1256 2012-02-13 19:06:16Z imad $ | |
| /* | |
| Warnings: |
This file contains hidden or 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 process_dwolla_transaction_status_callback(request): | |
| if request.method == 'POST': | |
| data = simplejson.loads(request.body) | |
| logger.info('Dwolla transaction status callback triggered with ' | |
| 'data: %s' % data) | |
| if check_dwolla_signature( | |
| request.META['HTTP_X_DWOLLA_SIGNATURE'], | |
| request.body): | |
| # Statuses can be found at: | |
| # https://developers.dwolla.com/dev/pages/statuses |
This file contains hidden or 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 django.contrib import admin | |
| from alert.donate.models import Donation | |
| from alert.userHandling.models import UserProfile | |
| class DonorInline(admin.TabularInline): | |
| model = UserProfile.donation.through | |
| max_num = 1 | |
| raw_id_fields = ('donation',) |
This file contains hidden or 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
| start_workers () { | |
| echo "Starting workers with command: " | |
| echo " $CELERYD_MULTI start $CELERYD_NODES $DAEMON_OPTS \ | |
| --pidfile=\"$CELERYD_PID_FILE\" \ | |
| --logfile=\"$CELERYD_LOG_FILE\" \ | |
| --loglevel=\"$CELERYD_LOG_LEVEL\" \ | |
| --cmd=\"$CELERYD\" $CELERYD_OPTS" | |
| $CELERYD_MULTI start $CELERYD_NODES $DAEMON_OPTS \ | |
| --pidfile="$CELERYD_PID_FILE" \ | |
| --logfile="$CELERYD_LOG_FILE" \ |
I hereby claim:
- I am mlissner on github.
- I am mlissner (https://keybase.io/mlissner) on keybase.
- I have a public key whose fingerprint is E64F 32B9 B2CE 993E 6D2A 60A5 DE79 459C D047 ACFE
To claim this, I am signing this object:
This file contains hidden or 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 warnings | |
| class CleanDateTime(datetime.datetime): | |
| def strftime(self, *args, **kwargs): | |
| # warnings.warn('strftime is deprecated', DeprecationWarning, | |
| # stacklevel=2) | |
| return super(CleanDateTime, self).strftime(*args, **kwargs) |
This file contains hidden or 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 | |
| print "Now killing strftime." | |
| class CleanDateTime(datetime.datetime): | |
| def strftime(self, format): | |
| raise NotImplemented( | |
| "Strftime doesn't support dates prior to 1900 and as a " | |
| "consequence CourtListener nukes them from the standard library. " |
NewerOlder