Skip to content

Instantly share code, notes, and snippets.

View adampetrovic's full-sized avatar

Adam Petrovic adampetrovic

View GitHub Profile
@adampetrovic
adampetrovic / 01 - Homebrew By Weight.md
Last active November 16, 2024 05:11
Homebrew by Weight - La Marzocco Linea Micra

This is my 'homebrew' version of the brew-by-weight functionality that comes with a Linea Mini plus the LaMarzocco + Acaia proprietary scales. Given I have a Micra, this functionality isn't supported out of the box.

It uses:

How it works:

  • input_number.coffee_target_weight: used to set the desired weight
@adampetrovic
adampetrovic / 01-debug.yaml
Last active March 9, 2024 23:04
Example Restic Setup
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: "debug"
spec:
accessModes: ["ReadWriteOnce"]
dataSourceRef:
kind: ReplicationDestination
apiGroup: volsync.backube
@adampetrovic
adampetrovic / tesla_solar_charging.yaml
Last active December 13, 2022 22:56
Charge Tesla with Excess Solar
sensor:
- platform: statistics
name: "Solar Export Median - 1 minute (internal)"
unique_id: solar_export_median_internal
entity_id: sensor.solarexport
state_characteristic: median
max_age:
minutes: 1
- platform: statistics
name: "Grid Import Median - 1 minute (internal)"
@adampetrovic
adampetrovic / query.flux.go
Last active June 17, 2022 05:34
InfluxDB (Flux): Calculating power cost from iotawatt using a time of use tariff and daily supply charge
import "date"
import "timezone"
import "dict"
option location = timezone.location(name: "Australia/Sydney")
tariffs = dict.fromList(pairs: [{key: "peak", value: 0.4070}, {key: "shoulder", value: 0.1815}, {key: "offpeak", value: 0.1540}, {key: "evoffpeak", value: 0.0770}])
dailySupplyCharge = 1.0494
getPrice = (timeVal) => {
hour = date.hour(t: timeVal)
@adampetrovic
adampetrovic / nuc 11
Last active November 18, 2021 20:30
EDIT: Now fixed with the latest Plex Server v1.25.0.5246 -- i7-1165G7 TigerLake GT2 [Iris Xe Graphics] segfault using lxc and passthrough GPU on proxmox 7. The following happens after about 10 minutes of transcoding on a plex server running in a docker container within LXC. See https://forums.plex.tv/t/anyone-have-been-able-to-hw-transcode-on-an…
[ 8238.497867] i915 0000:00:02.0: [drm] Resetting vcs1 for preemption time out
[ 8238.504252] i915 0000:00:02.0: [drm] GPU HANG: ecode 12:4:4ab6fff5, in Plex Transcoder [224824]
[ 8239.165883] i915 0000:00:02.0: [drm] Resetting vecs0 for preemption time out
[ 8239.166591] i915 0000:00:02.0: [drm] *ERROR* vecs0 reset request timed out: {request: 00000001, RESET_CTL: 00000001}
[ 8239.167282] i915 0000:00:02.0: [drm] GPU HANG: ecode 12:8:2cffbffd, in Plex Transcoder [227665]
[ 8241.565903] i915 0000:00:02.0: [drm] Resetting vcs0 for preemption time out
[ 8241.566619] i915 0000:00:02.0: [drm] *ERROR* vcs0 reset request timed out: {request: 00000001, RESET_CTL: 00000001}
[ 8241.567338] i915 0000:00:02.0: [drm] GPU HANG: ecode 12:4:2ffffffd, in Plex Transcoder [227668]
[ 8249.855124] i915 0000:00:02.0: [drm] GPU HANG: ecode 12:4:4ab6fff5, in Plex Transcoder [224824]
[ 8249.956638] i915 0000:00:02.0: [drm] Resetting vcs1 for stopped heartbeat on vcs1
from dateutil import parser, tz
from datetime import datetime, timezone
MAX_TIME_RANGE = 12 * 60 # how many minutes in the future to look at forecasts
BATTERY_CAPACITY = 82 # kWh - Tesla Model 3 Performance (2021)
CHARGE_RATE = 11 # kWh - Gen 3 Wall Connector (3 Phase 16A)
LOCAL_TZ = tz.gettz('Australia/Sydney')
def get_price_forecast():
@adampetrovic
adampetrovic / config.yaml
Created August 20, 2021 00:54
Frigate Config
detectors:
coral:
type: edgetpu
device: usb
ffmpeg:
input_args: >-
-avoid_negative_ts make_zero -fflags +genpts+discardcorrupt
-use_wallclock_as_timestamps 1
hwaccel_args:
@adampetrovic
adampetrovic / sentiment.py
Created February 9, 2018 03:22
Sentiment Analysis
import nltk
from instanalyze.logic import tweet_gen
# import tweet_gen
import pickle
import os
from instanalyze.logic.classifier import NaiveBayesClassifier
def create_data_path(relative_path):
path = os.getcwd()
if 'instanalyze' not in os.getcwd():
@adampetrovic
adampetrovic / README.md
Last active September 14, 2016 02:13
StarTrack Email Updates
  • Python 3
  • Gmail by default
  • Install requests (pip install requests)
  • Create the directory '.search_cache' where you are running the script from
  • Update EMAIL_ADDRESS and EMAIL_PASSWORD
  • Usage: python startrack_check.py
  • reference can be your 'TL' tracking code, or SBS from Telstra

Keybase proof

I hereby claim:

  • I am adampetrovic on github.
  • I am adampetrovic (https://keybase.io/adampetrovic) on keybase.
  • I have a public key ASDgb_44RUH8mlbweiMeVxO5Cq2PYG9WM1UPHOrC3ftxdgo

To claim this, I am signing this object: