Skip to content

Instantly share code, notes, and snippets.

View patrickscottbest's full-sized avatar

Patrick Best patrickscottbest

View GitHub Profile
@patrickscottbest
patrickscottbest / grafana.json
Last active October 2, 2022 23:55
Renogy Wanderer - Serial Modbus Script (modified for Wanderer 10A)
{
"annotations": {
"list": [
{
"builtIn": 1,
"datasource": "-- Grafana --",
"enable": true,
"hide": true,
"iconColor": "rgba(0, 211, 255, 1)",
"name": "Annotations & Alerts",
@patrickscottbest
patrickscottbest / s3pullorthaw.bash
Created May 12, 2021 11:47
S3 Bucket Restore Script for Mixed Glacier Files
#!/bin/bash
# Script to traverse a list of files and attempt to download if not present, and request Glacier thaw if unavailable.
# Can be run again once you suspect that Glacier has thawed your files.
# Ensure your "awsuser" account has the AWS credentials in place.
# Recommend running in nohup, this can be a long standing process.
# as root: nohup ./s3pullorthaw.bash > recovery.log 2>&1 &
# Set your bucket name
BUCKET=bucket_name
@patrickscottbest
patrickscottbest / howto.javascriptdjango.progressbar.txt
Created June 7, 2019 02:18
how to draw a javascript progress bar on a page from a django view
<div class="progress">
<div id="dynamic" class="progress-bar progress-bar-success progress-bar-striped active" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width: 0%">
<span id="current-progress"></span>
</div>
</div>
<script>
var current_progress = 0;
var interval = setInterval(function() {
var progressUrl = '{% url "detail_tasks" object.uuid %}';
fetch(progressUrl, {
@patrickscottbest
patrickscottbest / unique_random.py
Created February 26, 2019 18:09
Generate a unique random string in Django without the need for UUID or database locks
## this seems not good, but it's a shortcut
## you really shouldn't use this, k?
## uses the django make_random_password function
def unique_rand():
from django.contrib.auth.models import User
from .models import Whatever
#while True:
for _ in range(10):
code = User.objects.make_random_password(length=50)
@patrickscottbest
patrickscottbest / howto.cutycapt.txt
Last active January 29, 2019 18:43
Centos7 Headless install CutyCapt
yum info xorg-x11-server-Xvfb
sudo yum group install "Development Tools"
yum install qt
yum install qt4-devel-tools
yum install subversion
yum install qtwebkit
yum install qt5-qtwebkit
yum install qt5-qtbase-devel