Assorted shell and Python scripts

+feed_count.raku

+23 -3
+1
.gitignore
··· 1 1 .direnv 2 + .precomp
+1 -1
README.md
··· 1 1 # bin 2 2 3 - Assorted Python and shell scripts. 3 + Assorted Python, Raku, and shell scripts.
-2
feed_count
··· 1 1 #!/usr/bin/env nu 2 2 3 3 let mf_auth_token = (secret-tool lookup miniflux-auth-token hyperreal) 4 - let mf_password = (secret-tool lookup miniflux-password hyperreal) 5 4 let mf_api_url = "https://miniflux.bsd.cafe/v1/feeds/counters" 6 5 7 6 let unreads = ( ··· 10 9 -X GET \ 11 10 -H "Content-Type: application/json" \ 12 11 -H $"X-Auth-Token: ($mf_auth_token)" \ 13 - -u $"hyperreal:($mf_password)" \ 14 12 ($mf_api_url) 15 13 ) 16 14 | from json
+21
feed_count.raku
··· 1 + #!/usr/bin/env raku 2 + 3 + use Cro::HTTP::Client; 4 + use JSON::Fast; 5 + 6 + my $mf_auth_token = shell "secret-tool lookup miniflux-auth-token hyperreal", :out; 7 + my $mf_api_url = "https://miniflux.bsd.cafe/v1/feeds/counters"; 8 + 9 + my $client = Cro::HTTP::Client.new( 10 + headers => [ 11 + content-type => "application/json", 12 + x-auth-token => $mf_auth_token.out.slurp 13 + ], 14 + ); 15 + 16 + my $resp = await $client.get($mf_api_url); 17 + my %resp_json = await $resp.body; 18 + say %resp_json<unreads>.values.sum; 19 + 20 + 21 + # vim: ai et ft=raku sts=4 sw=4 ts=4