test subs checker

This commit is contained in:
Nikolai Rodionov 2023-04-15 19:29:07 +02:00
parent b3a371666d
commit 2a1915992f
No known key found for this signature in database
GPG Key ID: 19DB54039EBF8F10
3 changed files with 60 additions and 0 deletions

20
.drone.yml Normal file
View File

@ -0,0 +1,20 @@
---
# ----------------------------------------------
# -- Check subs
# ----------------------------------------------
kind: pipeline
type: kubernetes
name: Check subs
trigger:
event:
- push
# cron:
# - daily
steps:
- name: Check subs
image: alpine:latest
commands:
- apk update
- apk add curl jq perl git
- ./money/compare.pl

28
money/compare.pl Executable file
View File

@ -0,0 +1,28 @@
#!/usr/bin/perl
use strict;
use warnings;
my @subs = `tail -n +3 money/subs.md`;
chomp @subs;
my $today = `date +'%m.%d'`;
chop($today);
my $tommorow = `date -d '+1 day' +'%m.%d'`;
chop($tommorow);
my $fail = 0;
foreach my $sub (@subs) {
my @words = split /\|/, $sub;
my $date = $words[2];
$date =~ s/\./\\\./;
$date =~ s/\*/\./g;
$date =~ s/ //g;
my $regex = "m/$date/";
# print $regex;
if ($today =~ m/$date/ || $tommorow =~ m/$date/) {
print "$sub \n";
$fail = 1;
}
}
exit(1) if $fail;

12
money/subs.md Normal file
View File

@ -0,0 +1,12 @@
| Name | Date | Amount |
|-------------------------------|-------|--------|
| SoundCloud Repost | 04.03 | 30 |
| Hetzner | **.04 | ~25 |
| Splice | **.02 | 8 |
| CloudFlare Badhouseplants.net | 03.30 | 10.10 |
| CloudFlare nrodionov.info | 07.31 | 16.18 |
| DFV | **.15 | 5.30 |
| Spotify | **.16 | 15 |
| Vodafone Home WLAN | **.03 | 45 |
| ENBW | **.29 | 81 |
| Condo | **.29 | 1040 |