- selectolax
- AdvancedHTMLParser
- grequests
- parsel
- mechanicalsoup
- beautifulsoup4
This file contains 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
Update the server | |
$ apt-get update | |
Install pip3 | |
$ sudo apt-get install pip3 | |
Install virtualenv via pip | |
$ pip3 install virtualenv | |
Create a virtualenvs directory |
This file contains 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
CKEDITOR_SETTINGS = { | |
'language': '{{ language }}', | |
'skin': 'moono', | |
'toolbar_HTMLField': [ | |
['Source', '-', 'Save', 'NewPage', 'DocProps', 'Preview', 'Print', '-', 'Templates'], | |
['Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord', '-', 'Undo', 'Redo'], | |
['Find', 'Replace', '-', 'SelectAll', '-', 'SpellChecker', 'Scayt'], | |
['Form', 'Checkbox', 'Radio', 'TextField', 'Textarea', 'Select', 'Button', 'ImageButton', | |
'HiddenField'], | |
['Bold', 'Italic', 'Underline', 'Strike', 'Subscript', 'Superscript', '-', 'RemoveFormat'], |
This file contains 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
CKEDITOR_SETTINGS = { | |
'language': '{{ language }}', | |
'skin': 'moono', | |
'toolbar_HTMLField': [ | |
['Source', '-', 'Save', 'NewPage', 'DocProps', 'Preview', 'Print', '-', 'Templates'], | |
['Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord', '-', 'Undo', 'Redo'], | |
['Find', 'Replace', '-', 'SelectAll', '-', 'SpellChecker', 'Scayt'], | |
['Form', 'Checkbox', 'Radio', 'TextField', 'Textarea', 'Select', 'Button', 'ImageButton', | |
'HiddenField'], | |
['Bold', 'Italic', 'Underline', 'Strike', 'Subscript', 'Superscript', '-', 'RemoveFormat'], |
This file contains 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
PdfFile = PdfFileReader(f) | |
if PdfFile.isEncrypted: | |
try: | |
PdfFile.decrypt('') | |
print 'File Decrypted (PyPDF2)' | |
except: | |
import os | |
command = "cp " + f.name + " /tmp/temp.pdf; qpdf --password='' --decrypt /tmp/temp.pdf " + f.name + "_new" | |
os.system(command) | |
print 'File Decrypted (qpdf)' |
This file contains 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
#!/bin/bash | |
NAME="hello_app" # Name of the application | |
DJANGODIR=/webapps/hello_django/hello # Django project directory | |
SOCKFILE=/webapps/hello_django/run/gunicorn.sock # we will communicte using this unix socket | |
USER=hello # the user to run as | |
GROUP=webapps # the group to run as | |
NUM_WORKERS=3 # how many worker processes should Gunicorn spawn | |
DJANGO_SETTINGS_MODULE=hello.settings # which settings file should Django use | |
DJANGO_WSGI_MODULE=hello.wsgi # WSGI module name |
This file contains 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
# Author: Ryan Cole | |
# Website: https://ryanc.me | |
# GitHub: https://github.com/MGinshe | |
# Usage: | |
# Place this file in /etc/nginx/sites-enabled/ | |
# Make sure you edit the DOMAIN_HERE and SSL_CERTIFICATE, and DB_FILTER sections | |
# | |
# Note: This config file is designed to be used with the Odoo dbfilter_from_header module | |
# https://apps.openerp.com/apps/modules/9.0/dbfilter_from_header/ |
This file contains 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
docker run -v $(pwd):/src -it getlino |
This file contains 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
#!/bin/bash | |
# Location to place backups. | |
backup_dir="/var/backups/databases/" | |
nightly_dir="/var/backups/databases/latest/" | |
#String to append to the name of the backup files | |
backup_date=`date +%d-%m-%Y` | |
#Numbers of days you want to keep copie of your databases | |
number_of_days=15 | |
databases=`psql -l -t | cut -d'|' -f1 | sed -e 's/ //g' -e '/^$/d'` | |
for i in $databases; do if [ "$i" != "postgres" ] && [ "$i" != "template0" ] && [ "$i" != "template1" ] && [ "$i" != "template_postgis" ]; then |
This file contains 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.db.models import Count, Max | |
unique_fields = ['field_1', 'field_2'] | |
duplicates = ( | |
MyModel.objects.values(*unique_fields) | |
.order_by() | |
.annotate(max_id=Max('id'), count_id=Count('id')) | |
.filter(count_id__gt=1) | |
) |
OlderNewer