How do I do something like options kwarg JazzCore/python-pdfkit#222
options = {
"enable-local-file-access": True,
...
}
pdfkit.from_string(html_file, pdf_file, options=options, ...)
/* | |
error | |
Line 6: Char 14: error TS2448: Block-scoped variable 'res' used before its declaration. | |
*/ | |
/* code */ | |
function longestCommonSubsequence(arrays: number[][]): number[] { | |
// have a ptr for each array | |
let res = new Set(); | |
let setA = new Set<number>(arrays[0]); |
# sentry docs for filtering errors | |
# https://docs.sentry.io/platforms/python/guides/django/configuration/filtering/#event-hints | |
from django.urls import reverse_lazy | |
from django.db.utils import InterfaceError as djangoDbInterfaceError | |
... | |
def before_send(event, hint): | |
if 'exc_info' in hint: | |
exc_type, exc_value, tb = hint['exc_info'] |
LOGGING = { | |
'version': 1, | |
'disable_existing_loggers': False, | |
'formatters': { | |
'verbose': { | |
'format': '{levelname} {asctime} {module} {process:d} {thread:d} {message}', | |
'style': '{', | |
}, | |
}, | |
'handlers': { |
LOGGING = { | |
'version': 1, | |
'disable_existing_loggers': False, | |
'filters': { | |
'slow_queries': { | |
'()': 'django.utils.log.CallbackFilter', | |
# output slow queries only, unit are 1s, so 0.3 is 300ms | |
# ref 300ms * 0.001 = 0.3, 50ms * 0.001 = 0.05 | |
'callback': lambda record: record.duration > 0.05 | |
}, |
How do I do something like options kwarg JazzCore/python-pdfkit#222
options = {
"enable-local-file-access": True,
...
}
pdfkit.from_string(html_file, pdf_file, options=options, ...)
#!/bin/bash | |
hosts() { | |
VALID_COMMANDS=("help" "show" "samplefile" "activate" "deactivate") | |
NO_ARG_COMMANDS=("help" "show" "samplefile") | |
GREEN='\033[0;32m'; | |
RED='\033[0;31m'; | |
NOCOLOR='\033[0m'; | |
read -r -d '' SAMPLE_ETC_HOSTS_FILE <<HEREDOC |
print('instance', dir(template_context['instance'])) | |
> lists all variable fields |
results = myModel.objects.values().annotate( | |
group_representative=ArrayAggFirstElem('pk', distinct=True), | |
) | |
group_representatives = results.values_list('group_representative', flat=True) | |
assert_( | |
results.count() == group_representatives.count(), | |
'Aggregation Spec should partition the results space (no overlaps)' | |
) |
version: "3" | |
volumes: | |
local_postgres_data: {} | |
local_postgres_data_backups: {} | |
services: | |
django: &django | |
build: | |
context: . |
In this tutorial, I will be going over to how to deploy a Django app from start to finish using AWS and EC2. Recently, my partner Tu and I launched our app Hygge Homes (a vacation home rental app for searching and booking vacation homes based off Airbnb) and we wanted to share with other developers some of the lessons we learned along the way.
Following this tutorial, you will have an application that has: