Skip to content

Instantly share code, notes, and snippets.

View pettazz's full-sized avatar
🤷‍♂️
lol

Nick Pettazzoni pettazz

🤷‍♂️
lol
View GitHub Profile
version: "3"
services:
sonarr:
image: ghcr.io/linuxserver/sonarr:latest
container_name: sonarr
environment:
- PUID=1002
- PGID=1002
- TZ=America/New_York
volumes:
@pettazz
pettazz / home-assistant.service
Created November 15, 2020 18:55
home-assistant systemd unit
[Unit]
Description=Home Assistant service
Requires=docker.service
After=docker.service
[Service]
Restart=always
User=hassio
Group=hassio
@pettazz
pettazz / docker-compose.yml
Created November 15, 2020 18:54
home-assistant docker-compose.yml
version: '2'
services:
homeassistant:
container_name: home-assistant
image: homeassistant/home-assistant:stable
volumes:
- /opt/home-assistant/config:/config
devices:
- /dev/ttyUSB1:/dev/ttyUSB1
environment:
@pettazz
pettazz / convert_mdb.sh
Last active June 16, 2020 18:14
boy is this some extremely specific shit huh
#!/usr/bin/env bash
######################################################################
# #
# da config zone #
# #
######################################################################
# where to put all the converted files, relative to where this script lives
OUTPUT_DIR="output-dir"
@pettazz
pettazz / brightness.sh
Last active January 19, 2020 17:58
Set the brightness on certain Raspberry Pi compatible screens as a percentage
#!/usr/bin/env bash
if ! [[ $1 =~ ^-?[0-9]+$ ]]; then
echo "Percentage must be an integer" 1>&2
exit 1
fi
if (( $1 < 0 || $1 > 100 )); then
echo "Percentage value must be at least 0 or at most 100" 1>&2
exit 1
@pettazz
pettazz / button-handler.js
Last active July 29, 2018 19:47
AWS Lambda function to be triggered by an IoT button click, sends a message to SQS consumed by a homebridge server
/**
* This is a sample Lambda function that sends a message to an SQS queue
* when an IoT button is pressed. The message format is defined by the
* homebridge-sqs plugin: https://www.npmjs.com/package/homebridge-sqs
*
* The following JSON template shows what is sent as the payload:
{
"serialNumber": "GXXXXXXXXXXXXXXXXX",
"batteryVoltage": "xxmV",
"clickType": "SINGLE" | "DOUBLE" | "LONG"
@pettazz
pettazz / today-i-learned-xargs.sh
Created June 7, 2017 22:34
copy an existing file to a bunch of subdirectories
ls parent-dir/ | xargs -I{} -n 1 cp my-cool-file.tgz parent-dir/{}/
@pettazz
pettazz / clicks_for_vic.py
Created April 29, 2017 04:22
A great way to run out of memory quick
import threading
import time
from selenium import webdriver
TOTAL_WORKERS = 10
TWITTER_USER = 'butts'
TWITTER_PASSWORD = 'bu77s'
def worker():
@pettazz
pettazz / osto.us-yxorp-ssl.conf
Last active April 16, 2019 11:13
Reverse SSL proxy apache config
<IfModule mod_ssl.c>
<VirtualHost *:443>
ServerName osto.us
ServerAlias osto.us
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
@pettazz
pettazz / butwhy.php
Created March 13, 2017 19:13
png image from hex string
<?php
$data = 'blah';
$data = hex2bin($data);
header('Content-Type: image/png');
imagepng(imagecreatefromstring($data));
?>