Skip to content

Instantly share code, notes, and snippets.

@pawl
pawl / example.html
Created December 30, 2014 10:59
Flask Inline Editing Example Using WTForms + X-Editable
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>title</title>
<link href="//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css" rel="stylesheet">
<link href="//cdnjs.cloudflare.com/ajax/libs/x-editable/1.5.0/bootstrap3-editable/css/bootstrap-editable.css" rel="stylesheet"/>
<script src="http://code.jquery.com/jquery-2.0.3.min.js"></script>
@pawl
pawl / sketch.ino
Created September 12, 2020 04:14
modbus arduino max6675 artisan roasterscope
/*
* This sketch programs Ardunio to communicate with Artisan using MODBUS protocol and
* an inexpensive thermocouple amplifier.
*
* Hardware:
* Arduino UNO
* Thermocouple amplifier (MAX6675 or MAX31855)
* K-type thermocouple
*
* Libraries needed:
@pawl
pawl / new_probe.ino
Last active February 12, 2024 19:12
arduino modbus coffee roaster with 2 thermocouples for artisan software
/*
* This sketch programs Ardunio to communicate with Artisan using MODBUS protocol and
* an inexpensive thermocouple amplifier.
*
* Hardware:
* Arduino UNO
* Thermocouple amplifier (MAX6675)
* K-type thermocouple
*
* Libraries needed:
@pawl
pawl / bindparameters.py
Created August 6, 2014 18:52
Use List In Bind Parameters - SQLAlchemy
my_list = ['peach', 'grape', 'apple']
query_parameters = {}
counter = 1
for list_item in my_list:
query_parameters["list_item" + str(counter)] = list_item
counter += 1
where_clause = 'fruits IN(:' + ",:".join(query_parameters.keys()) + ')' # create clause to be inserted into query
query_text = db.text("""
SELECT
@pawl
pawl / webdav.conf
Last active August 1, 2023 05:41
Installing nginx webdav server on ubuntu 20.04
server {
listen 80;
listen [::]:80;
root /var/dav/webdav_root;
# dav allowed method
dav_methods PUT DELETE MKCOL COPY MOVE;
# Allow current scope perform specified DAV method
dav_ext_methods PROPFIND OPTIONS;
@pawl
pawl / gist:8ede83279908f686df94bb8db9e63cc8
Created April 29, 2023 23:47
shinobi nvr with gluetun wireguard through pivpn
version: "3"
services:
shinobi:
image: registry.gitlab.com/shinobi-systems/shinobi:dev
container_name: Shinobi
environment:
- PLUGIN_KEYS={}
- SSL_ENABLED=false
volumes:
- ~/Shinobi/config:/config
@pawl
pawl / copy_table.py
Last active January 17, 2023 20:48
Copy Schema Of A Remote Database Table To A New Local Table With SQLalchemy
from sqlalchemy import create_engine, Table, Column, Integer, Unicode, MetaData, String, Text, update, and_, select, func, types
# create engine, reflect existing columns, and create table object for oldTable
srcEngine = create_engine('mysql+mysqldb://username:password@111.111.111.111/database') # change this for your source database
srcEngine._metadata = MetaData(bind=srcEngine)
srcEngine._metadata.reflect(srcEngine) # get columns from existing table
srcTable = Table('oldTable', srcEngine._metadata)
# create engine and table object for newTable
destEngine = create_engine('mysql+mysqldb://username:password@localhost/database') # change this for your destination database
@pawl
pawl / readme.md
Last active January 8, 2023 13:39
test to see if psycogreen is necessary to run sqlalchemy + gevent + psycopg2 concurrently

This is a test to see if psycogreen is necessary to run sqlalchemy + gevent + psycopg2 concurrently.

benchmark command (concurrency of 10)

ab -n 10 -c 10 127.0.0.1:8080/wait

psychopg2 - sync worker (expecting concurrency of 2)

gunicorn -b 127.0.0.1:8080 -w 2 test:app

@pawl
pawl / cups-orangepi.md
Last active June 8, 2022 12:56
installing CUPS on orangepi zero
  1. download ubuntu image for orangepi zero LTS: http://www.orangepi.org/downloadresources/
  2. flash with etcher
  3. fiddle with USB to TTL, gave up on trying to get that to work
  4. plug ethernet into switch
  5. ssh orangepi@
  6. password orangepi
  7. couldn't successfully apt-get update upgrade, getting E: Unable to acquire the dpkg frontend lock
  8. download armbian image for orangepi zero LTS: http://www.orangepi.org/downloadresources/
  9. flash with etcher
  10. armbian-config
@pawl
pawl / raspberry_pi_3b.txt
Last active March 17, 2022 19:13
pihole performance - raspberry pi 4b vs3b vs zero w
$ go run dnstrace.go -c 10 -s 192.168.1.94 -n 100 www.googletagservices.com
Benchmarking 192.168.1.94:53 via udp with 10 conncurrent requests
Total requests: 1000 of 1000 (100.0%)
DNS success codes: 1000
DNS response codes
NOERROR: 1000