test subs checker
This commit is contained in:
		
							
								
								
									
										20
									
								
								.drone.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										20
									
								
								.drone.yml
									
									
									
									
									
										Normal 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
									
								
							
							
						
						
									
										28
									
								
								money/compare.pl
									
									
									
									
									
										Executable 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
									
								
							
							
						
						
									
										12
									
								
								money/subs.md
									
									
									
									
									
										Normal 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   |
 | 
			
		||||
		Reference in New Issue
	
	Block a user