Skip to content

Instantly share code, notes, and snippets.

View sam2332's full-sized avatar

Lily Rudloff sam2332

  • Ingham County
  • Lansing, Michigan
View GitHub Profile
@sam2332
sam2332 / TripCard.js
Last active September 4, 2024 17:18
Home Assistant Trip Card
import "https://unpkg.com/wired-card@0.8.1/wired-card.js?module";
import "https://unpkg.com/wired-toggle@0.8.0/wired-toggle.js?module";
import { LitElement, html, css } from "https://unpkg.com/lit-element@2.0.1/lit-element.js?module";
class TripsCard extends LitElement {
static get properties() {
return {
person: { type: String },
homeZone: { type: String },
hours: { type: Number },
@sam2332
sam2332 / StateDuration.js
Created September 3, 2024 20:18
HomeAssistant Lovelace js module for showing durations of states, useful for person trackers
class StateDurationCard extends HTMLElement {
set hass(hass) {
this._hass = hass;
if (!this.content) {
const cardTitle = this.config.title || 'State Duration Totals';
this.innerHTML = `
<ha-card>
<div class="card-header">
<div class="name" style="cursor: pointer;">${cardTitle}</div>
@sam2332
sam2332 / SimpleLogCard.js
Last active August 6, 2024 17:16
Simple Daily Log
class SimpleLogCard extends HTMLElement {
set hass(hass) {
this._hass = hass;
if (!this.content) {
const title = this.config.title || 'Sensor Log';
this.innerHTML = `
<ha-card header="${title}">
<div class="card-content"></div>
</ha-card>
`;
@sam2332
sam2332 / system_path_file_checker.py
Last active July 22, 2024 14:18
Check System paths for command overwrites
import os
import pwd
import grp
import hashlib
from collections import defaultdict
# Trusted users
TRUSTED_USERS = ['root']
# Base system directories
@sam2332
sam2332 / weather_related_wallpaper.py
Created July 18, 2024 19:54
home assistant pyscript to select a wall paper and replace the file in www dir
@sam2332
sam2332 / espcam_history_file.py
Last active July 18, 2024 20:04
pyscript to generate a history of camera images
#render html file with table of Image, Dates in rows, from the espcam_history folder with filenames lik livingroom-2024-04-23_20-36.jpg
import os
import sys
import datetime
import re
import subprocess
import argparse
import jinja2
import logging
@sam2332
sam2332 / Rainbow-HACards.js
Created July 18, 2024 19:37
Javascript to add color rotating rainbow border to home assistant cards.
setTimeout(function(){
function getAllHaCards(root = document) {
const haCards = [];
const elements = root.querySelectorAll('*');
elements.forEach(element => {
if (element.shadowRoot) {
haCards.push(...element.shadowRoot.querySelectorAll('ha-card'));
haCards.push(...getAllHaCards(element.shadowRoot));
}
@sam2332
sam2332 / StableWallpapers.ipynb
Last active July 5, 2024 13:30
StableWallpapers!
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@sam2332
sam2332 / Validate_page_links.user.js
Last active July 1, 2024 17:04
User script to scan web links on pages and highlight broken pages.
@sam2332
sam2332 / DictList2CSV.py
Created May 23, 2024 19:48
Simple json conversion tool, reusable
# Description: This script converts a json file to a csv file
# Author: Lily Rudloff
# Date: 05-23-2024
# Version: 1.0
# Usage: python convert_to_csv.py input.json output.csv
# Notes: This script requires the json file to be a list of dictionaries
# where each dictionary represents a row in the csv file.
# The keys of the first dictionary will be used as the headers
# for the csv file.