From 2a1915992f5438c50d6b6837009e9dc6f625f7ec Mon Sep 17 00:00:00 2001 From: Nikolai Rodionov Date: Sat, 15 Apr 2023 19:29:07 +0200 Subject: [PATCH] test subs checker --- .drone.yml | 20 ++++++++++++++++++++ money/compare.pl | 28 ++++++++++++++++++++++++++++ money/subs.md | 12 ++++++++++++ 3 files changed, 60 insertions(+) create mode 100644 .drone.yml create mode 100755 money/compare.pl create mode 100644 money/subs.md diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 0000000..d18a362 --- /dev/null +++ b/.drone.yml @@ -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 diff --git a/money/compare.pl b/money/compare.pl new file mode 100755 index 0000000..ae1f8e2 --- /dev/null +++ b/money/compare.pl @@ -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; diff --git a/money/subs.md b/money/subs.md new file mode 100644 index 0000000..76ac6cb --- /dev/null +++ b/money/subs.md @@ -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 |