Skip to content

Instantly share code, notes, and snippets.

@hollie
hollie / run-slow-and-process-async.pl
Created April 4, 2023 08:17
Example script to wait for the output of another slow process in Perl with realtime updates
#! /usr/bin/env perl
# This is an example script that shows how to wait for output from an external process
# It waits for different outputs from the external scripts via regular expressions
# And it demonstrates timeout while waiting.
use Modern::Perl '2021';
use Expect;
my $command = './slow-script.pl'; # Slow external script to execute
@hollie
hollie / error-500-gitea
Created September 16, 2022 15:24
Log of errors leading to a error 500 when trying to view a repo website
docker-organisation-gitea-1 | 2022/09/16 17:17:40 ...dules/git/command.go:153:Run() [D] [63249394] /data/git/repositories/organisation/perl-device-dummy.git: /usr/bin/git -c protocol.version=2 -c uploadpack.allowfilter=true -c uploadpack.allowAnySHA1InWant=true -c credential.helper= rev-parse
docker-organisation-gitea-1 | 2022/09/16 17:17:40 ...dules/git/command.go:153:Run() [D] [63249394] /data/git/repositories/organisation/perl-device-dummy.git: /usr/bin/git -c protocol.version=2 -c uploadpack.allowfilter=true -c uploadpack.allowAnySHA1InWant=true -c credential.helper= show-ref --tags
docker-organisation-gitea-1 | 2022/09/16 17:17:40 ...dules/git/command.go:153:Run() [D] [63249394] /data/git/repositories/organisation/perl-device-dummy.git: /usr/bin/git -c protocol.version=2 -c uploadpack.allowfilter=true -c uploadpack.allowAnySHA1InWant=true -c credential.helper= cat-file --batch
docker-organisation-gitea-1 | 2022/09/16 17:17:40 ...dules/git/command.go:153:Run() [D] [63249394] /data/git/repositories/org
@hollie
hollie / gist:2300e1c6df804d29d24adcdaaecd44b0
Created September 5, 2021 19:28
Example I2C code on SAMD21 for Martin
// vi:ts=4
// ----------------------------------------------------------------------------
// HelloWorld - simple demonstration of lcd
// Created by Bill Perry 2016-07-02
// bperrybap@opensource.billsworld.billandterrie.com
//
// This example code is unlicensed and is released into the public domain
#include <Wire.h>
#include <hd44780.h> // main hd44780 header
@hollie
hollie / ssl_check.yaml
Last active May 29, 2021 15:09
SSL check blueprint
blueprint:
name: Certificate Expiration by bkbilly
description: 'This automation blueprint notifies when a SSL certificate is about to expire'
domain: automation
input:
certificate_input:
name: Certificate
description: The certificate timestamp
selector:
entity:
@hollie
hollie / test-https.pl
Created April 24, 2020 07:14
Test script to check if HTTPS works with the current perl installation
#! /usr/bin/env perl
use LWP::UserAgent;
my $ua = LWP::UserAgent->new;
my $req = HTTP::Request->new(GET => 'https://google.com');
my $res = $ua->request($req);
if ($res->is_success) {
print $res->as_string;
@hollie
hollie / test_sync_time.pl
Created April 19, 2020 10:05
Sync time script for AlphaClock 5 over BT serial port
#! /usr/bin/env perl
use strict;
use warnings;
use 5.010;
use Device::SerialPort;
my $name = 'Foo';
my $bt_address = 'D5:89:1F:09:51:15';
say "PID $$";

Keybase proof

I hereby claim:

  • I am hollie on github.
  • I am hollie (https://keybase.io/hollie) on keybase.
  • I have a public key ASAbq7hLiVYGF4gV-ea_MFGFpfZ1pWad7kWVT5ZolKudxwo

To claim this, I am signing this object:

@hollie
hollie / xpl_test.pl
Last active December 10, 2016 07:57
Example code for MisterHouse: react to xPL-enabled motion detector
# In items.mht:
# XPL_SENSOR, hollie-jeenodes.nessie:room31, motion_berging, Berging, motion
# in user code
if ($motion_berging->state_changed()) {
my $state = $motion_berging->state();
if ($plafond_berging->get_set_by() =~ /^web/ && $plafond_berging->state() ne 'off') {
# Was set on by web interface, don't react to motion detector right now to allow forcing the light to steady 'on' via web interface
@hollie
hollie / mh_temp.user_code
Created March 20, 2016 20:22
v4.1 + fix Eloy generated user code
# List of X10_Item objects
use vars qw($backyard_light $bedroom_light1 $bedroom_light2 $garage_light $test_light1 $test_light2);
# List of X10_Appliance objects
use vars qw($fountain);
# List of Voice_Cmd objects
use vars qw($my_test1 $organizer_check $restart_tts $test_speak_mode $test_speech_flags $test_volume $v_clear_cache $v_debug $v_debug_toggle $v_fountain $v_garage_light $v_get_ical_data $v_http_control $v_list_debug_options $v_list_serial_items $v_list_voice_cmds $v_list_x10_items $v_listen $v_mhdl_page $v_mode $v_mode_toggle $v_read_tables $v_reboot $v_reboot_abort $v_reload_code $v_reload_code2 $v_repeat_last_spoken $v_restart_mh $v_set_password $v_show_debug $v_speed_benchmark $v_test_light2 $v_test_lights $v_undo_last_change $v_update_docs $v_uptime $v_version $v_voice_cmds_help $v_what_speed);
# List of Timer objects
@hollie
hollie / mh_temp.user_code
Created March 20, 2016 20:03
v4.1 generated user code
# List of X10_Item objects
use vars qw($backyard_light $bedroom_light1 $bedroom_light2 $garage_light $test_light1 $test_light2);
# List of X10_Appliance objects
use vars qw($fountain);
# List of Voice_Cmd objects
use vars qw($my_test1 $organizer_check $restart_tts $test_speak_mode $test_speech_flags $test_volume $v_clear_cache $v_debug $v_debug_toggle $v_fountain $v_garage_light $v_get_ical_data $v_http_control $v_list_debug_options $v_list_serial_items $v_list_voice_cmds $v_list_x10_items $v_listen $v_mhdl_page $v_mode $v_mode_toggle $v_read_tables $v_reboot $v_reboot_abort $v_reload_code $v_reload_code2 $v_repeat_last_spoken $v_restart_mh $v_set_password $v_show_debug $v_speed_benchmark $v_test_light2 $v_test_lights $v_undo_last_change $v_update_docs $v_uptime $v_version $v_voice_cmds_help $v_what_speed);
# List of Timer objects