We've learned SyncWorker for gunicorn in part1, now let's see how other workers work
There are numerous reasons you may need to use multiple SSH keys for accessing GitHub and BitBucket
You may use the same computer for work and personal development and need to separate your work.
When acting as a consultant, it is common to have multiple GitHub and/or BitBucket accounts depending on which client you may be working for.
You may have different projects you're working on where you would like to segregate your access.
| import requests | |
| from requests.adapters import HTTPAdapter, Retry | |
| DEFAULT_TIMEOUT = 5 | |
| class TimeoutHTTPAdapter(HTTPAdapter): | |
| """Set a default timeout for all HTTP calls.""" |
Unless otherwise noted (either in this file or in a file's copyright section) the contents of this gist are Copyright ©️2020 by Christopher Allen, and are shared under spdx:Creative Commons Attribution Share Alike 4.0 International (CC-BY-SA-4.) open-source license.
If you more tips and advice like these, you can become a monthly patron on my GitHub Sponsor Page for as little as $5 a month; and your contributions will be multipled, as GitHub is matching the first $5,000! This gist is all about Homebrew, so if you like it you can support it by donating to them or becoming one of their Github Sponsors.
| import smtplib | |
| import traceback | |
| from email import encoders | |
| from email.mime.base import MIMEBase | |
| from email.mime.multipart import MIMEMultipart | |
| from email.mime.text import MIMEText | |
| from email.utils import COMMASPACE, formataddr, formatdate, parseaddr | |
| from pathlib import Path | |
| from typing import List |
| --- Include/objimpl.h | |
| +++ Include/objimpl.h | |
| @@ -250,7 +250,7 @@ | |
| union _gc_head *gc_prev; | |
| Py_ssize_t gc_refs; | |
| } gc; | |
| - double dummy; /* force worst-case alignment */ | |
| + long double dummy; /* force worst-case alignment */ | |
| } PyGC_Head; |
| from django.contrib import admin | |
| from django.core.paginator import Paginator | |
| from django.db import connection, transaction, OperationalError | |
| from django.utils.functional import cached_property | |
| class MariaDbInnoDbPaginator(Paginator): | |
| """ | |
| Paginator that enforces a 2 second timeout on the count operation. | |
| If the operations times out, an approximate value is returned. |
| class TimeLimitedPaginator(Paginator): | |
| """ | |
| Paginator that enforced a timeout on the count operation. | |
| When the timeout is reached a "fake" large value is returned instead, | |
| Why does this hack exist? On every admin list view, Django issues a | |
| COUNT on the full queryset. There is no simple workaround. On big tables, | |
| this COUNT is extremely slow and makes things unbearable. This solution | |
| is what we came up with. | |
| """ |
| # ~/.bashrc: executed by bash(1) for non-login shells. | |
| # If file exists (likely) copy fragment below into existing script: | |
| # If stdin is a terminal | |
| if [ -t 0 ]; then | |
| # Set GPG_TTY so gpg-agent knows where to prompt. See gpg-agent(1) | |
| export GPG_TTY="$(tty)" | |
| # Set PINENTRY_USER_DATA so pinentry-auto knows to present a text UI. | |
| export PINENTRY_USER_DATA=USE_TTY=1 |
| # use the tee command to write to a file while also viewing it | |
| # the following will redirect both stdout and stderr to the file | |
| command 2&>1 | tee output.log |
