Skip to content

Instantly share code, notes, and snippets.

View djotaku's full-sized avatar

Eric Mesa djotaku

View GitHub Profile
/*
* Master Bathroom environmental sensor
*
* Intended for IoT Home Automation projects involving the Master Bathroom.
*
* The current circuit:
*
* - Arduino MKR WiFi 1010
* - Arudiono MKR ENV Shield attached
*
@djotaku
djotaku / ahtx0_simpletest.py
Created August 5, 2020 03:56
unsuccessful humidity readings from ahtx0
import time
import board
import adafruit_ahtx0
# Create the sensor object using I2C
sensor = adafruit_ahtx0.AHTx0(board.I2C())
while True:
#temp = (sensor.temperature * 9.0/5.0) + 32
temp = sensor.temperature * 1.8 + 32
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
# Path to your oh-my-zsh installation.
export ZSH="/home/username/.oh-my-zsh"
# Set name of the theme to load --- if set to "random", it will
# load a random theme each time oh-my-zsh is loaded, in which case,
# to know which specific one was loaded, run: echo $RANDOM_THEME
# See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes
╰─$ toolbox create -vv 1 ↵
DEBU Running as real user ID 1000
DEBU Resolved absolute path to the executable as /usr/bin/toolbox
DEBU Running on a cgroups v2 host
DEBU Checking if /etc/subgid and /etc/subuid have entries for user ermesa
DEBU TOOLBOX_PATH is /usr/bin/toolbox
DEBU Toolbox config directory is /home/ermesa/.config/toolbox
INFO[0000] podman filtering at log level debug
DEBU[0000] Called version.PersistentPreRunE(podman --log-level debug version --format json)
DEBU[0000] Reading configuration file "/usr/share/containers/containers.conf"
@djotaku
djotaku / gist:defce46630cb69071aa577a170cba448
Created June 5, 2021 23:45
trying to get multiple choice results back
in forms.py:
def create_user_choices():
users = User.objects.get_queryset()
return [(user, f"{user.first_name} {user.last_name}") for user in users]
class RandomizeForm(forms.Form):
def __init__(self, *args, **kwargs):
super(RandomizeForm, self).__init__(*args, **kwargs)
@djotaku
djotaku / gist:12ca816a82ee29fdf78a6755d959676a
Created January 17, 2022 16:41
kodi crashlog on Fedora Silverblue 34
############## Kodi CRASH LOG ###############
################ SYSTEM INFO ################
Date: Sun Jan 16 15:26:28 EST 2022
Kodi Options:
Arch: x86_64
Kernel: Linux 5.13.16-200.fc34.x86_64 #1 SMP Mon Sep 13 12:39:36 UTC 2021
Release: Freedesktop.org 21.08.9 (Flatpak runtime)
############## END SYSTEM INFO ##############
pip install --upgrade -v eldonationtracker
Using pip 22.1.2 from /home/ermesa/Programming Projects/python/test_pip/venv/lib64/python3.10/site-packages/pip (python 3.10)
Requirement already satisfied: eldonationtracker in ./venv/lib/python3.10/site-packages (7.3.0)
Collecting eldonationtracker
Using cached eldonationtracker-7.4.3-py3-none-any.whl (114 kB)
Requirement already satisfied: xdgenvpy==2.3.5 in ./venv/lib/python3.10/site-packages (from eldonationtracker) (2.3.5)
Requirement already satisfied: PyQt5-sip<=12.8.9,>=12.8.1 in ./venv/lib/python3.10/site-packages (from eldonationtracker) (12.8.1)
Requirement already satisfied: semver==2.9.1 in ./venv/lib/python3.10/site-packages (from eldonationtracker) (2.9.1)
Collecting rich==12.4.1
Using cached rich-12.4.1-py3-none-any.whl (231 kB)
# async version 1
import asyncio
import httpx
async def get_weather(city: str, state: str) -> dict:
url = f"https://weather.talkpython.fm/api/weather?city={city}&state={state}&country=US&units=imperial"
async with httpx.AsyncClient() as client:
response = await client.get(url, follow_redirects=True)
return response.json()
import asyncio
import json
import os
import sys
import time
from typing import List, Optional, Dict
# noinspection PyPackageRequirements
import progressbar
from dateutil.parser import parse
Importing users ...
Traceback (most recent call last):
File "/home/ermesa/Programming Projects/Python/fastapi_mongodb_class_notes/venv/lib/python3.10/site-packages/beanie/odm/documents.py", line 403, in save
return await self.replace(session=session, **kwargs)
File "/home/ermesa/Programming Projects/Python/fastapi_mongodb_class_notes/venv/lib/python3.10/site-packages/beanie/odm/actions.py", line 212, in wrapper
result = await f(self, *args, skip_actions=skip_actions, **kwargs)
File "/home/ermesa/Programming Projects/Python/fastapi_mongodb_class_notes/venv/lib/python3.10/site-packages/beanie/odm/utils/state.py", line 39, in wrapper
result = await f(self, *args, **kwargs)
File "/home/ermesa/Programming Projects/Python/fastapi_mongodb_class_notes/venv/lib/python3.10/site-packages/beanie/odm/utils/state.py", line 50, in wrapper
result = await f(self, *args, **kwargs)