View settings.py
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
''' | |
There are likely a few fixes for this but you are likely to see this error | |
if your app needs to reach out to an https server (in this case https://google.com) | |
and it cannot verify the ssl certificate. | |
The certifi package ( https://pypi.org/project/certifi/ ) provides a | |
curated collection of Root Certificates that avoids this. | |
pip install certifi - then in your settings you just need to set | |
the environmental variable for REQUESTS_CA_BUNDLE and SSL_CERT_FILE. |
View nginx-ansible-server.yaml
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
# post base server setup | |
# nginx, pulls confs from git repo | |
# certbot setup and general firewall conf | |
# | |
- hosts: nginxweb | |
become: yes | |
vars: | |
my_ip_range: x.x.x.x/24 | |
my_jump_ip: x.x.x.x |
View renew-certs.sh
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 | |
# Likely in a cron job to handle cert renewals. | |
# The acme go client is here - https://github.com/go-acme/lego | |
lego_bin=/etc/goclient/lego/lego | |
lego_path=/etc/goclient/lego | |
lego_certs="$lego_path/certificates" | |
web_root=/var/www/html | |
our_kid="" |
View blogmodel.py
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 import models | |
from django.utils.text import slugify, Truncator | |
from django.db.models.functions import Lower | |
from django.db.models.signals import pre_save, post_save, post_delete, m2m_changed | |
from django.contrib.postgres.search import SearchVectorField, SearchVector | |
from django.contrib.postgres.indexes import GinIndex | |
from django.db.models import Value | |
import re |
View push-django-updates.yaml
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
- hosts: webservers | |
become: yes | |
vars: | |
my_ip_range: x.x.x.x/24 | |
my_db: x.x.x.x | |
#following from cloudflare.com/ips | |
cf_1: 173.245.48.0/20 | |
cf_2: 103.21.244.0/22 | |
cf_3: 103.22.200.0/22 | |
cf_4: 103.31.4.0/22 |
View load_remote_images.py
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 csv import DictReader | |
from django.core.files import File | |
import urllib.request | |
from urllib.request import urlopen | |
from tempfile import NamedTemporaryFile | |
from django.core.management.base import BaseCommand | |
import time | |
from PIL import Image | |
from io import BytesIO | |
from django.core.files.base import ContentFile |
View bash_profile.sh
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
# alias to provide readable directory listings when using mounted google drives on linux | |
alias lg='gio list -a "standard::display-name"' | |
View create-products-from-csv.php
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
<?php namespace ProcessWire; | |
// This is an example of the transfer of product data (could be anything) | |
// from a csv to their corresponding fields in a processwire template | |
// and creating the pages. This uses the processwire feature of instantiating | |
// an instance from a command line script to access global variables | |
// (https://processwire.com/blog/posts/multi-instance-pw3/). | |
require('/var/www/dev.dev.com/wire/core/ProcessWire.php'); | |
$st = new ProcessWire('/var/www/dev.dev.com/', 'https://dev.dev.com/'); |
View apt-update-upgrade.yml
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
--- | |
- hosts: mytargets | |
become: true | |
tasks: | |
- name: update apt repo and cache | |
apt: | |
upgrade=dist | |
update_cache=yes | |
force_apt_get=yes | |
cache_valid_time=3600 |
View processwire-google-merchant-csv.php
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
<?php namespace ProcessWire; | |
require('/var/www/yourpw.com/wire/core/ProcessWire.php'); | |
$st = new ProcessWire('/var/www/yourpw.com/', 'https://yourpw.com/'); | |
// gmerchant header | |
//id title description link condition price availability image link gtin mpn brand google product category | |
//product_to_google is a pw field - if 1 send it to google, if 0 do not send | |
$myGmerchantProducts = $st->pages->find("template=page-general-product|page-other-product, product_to_google=1, sort=title"); | |
$howMany = 0; |
NewerOlder