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
LOGGING = { | |
'version': 1, | |
'disable_existing_loggers': False, | |
'handlers': { | |
'mail_admins': { | |
'level': 'ERROR', | |
'class': 'django.utils.log.AdminEmailHandler' | |
}, | |
'null': { | |
'level':'DEBUG', |
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
#!/usr/bin/python | |
#Kwh per weekday | |
import time | |
import logging | |
import calendar | |
from datetime import datetime | |
import redis |
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/sh | |
# Install node and npm via nvm - https://github.com/nvm-sh/nvm | |
# Run this script like - bash script-name.sh | |
# Define versions | |
INSTALL_NODE_VER=22 | |
INSTALL_NVM_VER=0.40.1 |
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 .models import Post, Category | |
from .decorators import action_form | |
class PostCategoryForm(forms.Form): | |
title = 'Update category for the selected posts' | |
myfile = forms.FileField() | |
category = forms.ModelChoiceField(queryset=Category.objects.all()) | |
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
import io | |
import selectors | |
import subprocess | |
import sys | |
def capture_subprocess_output(subprocess_args): | |
# Start subprocess | |
# bufsize = 1 means output is line buffered | |
# universal_newlines = True is required for line buffering | |
process = subprocess.Popen(subprocess_args, |
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
# -*- coding: utf-8 -*- | |
""" | |
Purpose: Convert .NET ticks to formatted ISO8601 time | |
Author: D Hohls < [email protected]> | |
""" | |
from __future__ import print_function | |
import datetime | |
import sys | |
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
# coding: utf-8 | |
"""Command-line access to stats from https://www.worldometers.info/coronavirus/ | |
Created: 2020-04-05 | |
Author: Derek <[email protected]> | |
Requires: | |
chromedriver - https://chromedriver.chromium.org/ | |
xlsxwriter - https://xlsxwriter.readthedocs.io/ | |
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
# Backup | |
docker exec $CONTAINERID /usr/bin/mysqldump -u root -proot $DATABASE > backup.sql | |
# Restore | |
cat backup.sql | docker exec -i $CONTAINERID /usr/bin/mysql -u root -proot $DATABASE | |