This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
import { ImageGenerator } from "ImageGenerator"; | |
interface Props { | |
imgPath: string, | |
alt: string, | |
sizes: { width: number; height: number }[], | |
withWebp?: boolean, | |
loading?: "eager" | "lazy" | null, | |
breakpoints?: {maxWidth: number, imgWidth: number}[] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import type { AstroIntegration } from "astro"; | |
import sharp from 'sharp'; | |
import path from 'path'; | |
import fs from 'fs'; | |
type imageSize = { width: number, height: number }; | |
export default function createPlugin(): AstroIntegration { | |
return { | |
name: "ImageCompressorIntegration", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This script is part of my blog post: https://tomoviktor.com/posts/pialarm-alarmrunner | |
CLEVER_SLEEP_SECS_SEGMENTS = 1 | |
from numexpr import evaluate as ne_eval | |
from json import load | |
from os import environ | |
from time import sleep as time_sleep | |
from led_controller import LedController | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This script is part of my blog post: https://tomoviktor.com/posts/pialarm-passcodes | |
PASSCODES_JSON_PATH = "passcodes.json" | |
from secrets import token_urlsafe as secrets_token_urlsafe | |
from hashlib import sha1 | |
passcodes_file = open(PASSCODES_JSON_PATH, "w") | |
passcodes_file.write("[") | |
hashes_generated = [] | |
for day_num in range(31): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This script is part of my blog post: https://tomoviktor.com/posts/pialarm-physical | |
from time import sleep | |
from led_controller import LedController | |
controller = LedController() | |
controller.red = 255 | |
color_sequence = [ | |
(255, 255, 0), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This script is part of my blog post: https://tomoviktor.com/posts/pialarm-ledcontroller | |
DEV_MODE = True | |
RGB_PINS = {"red": 17, "green": 22, "blue": 24} | |
from colour import Color | |
if not DEV_MODE: from pigpio import pi | |
if DEV_MODE: | |
import PySimpleGUI as sg | |
from threading import Thread |