Guest User

Untitled

a guest
Jul 1st, 2023
368
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.49 KB | None | 0 0
  1. #!/usr/bin/perl -w
  2. # To create sound file:
  3. # youtube-dl -x "https://www.youtube.com/watch?v=MFw3E6X5aoA" --audio-format vorbis -o ~/noot-noot.mp4
  4. $| = 1;
  5.  
  6. my $fh;
  7. open($fh, "-|", "/usr/bin/ping", @ARGV) or die "Can't run ping: $!";
  8. while(my $line = <$fh>) {
  9.     chomp $line;
  10.     print $line;
  11.  
  12.     if ( $line =~ /^\d+ bytes from/ ) {
  13.         print " (noot noot!)";
  14.         if ( system("/usr/bin/paplay", "$ENV{HOME}/noot-noot.ogg") != 0 ) {
  15.             close $fh if ( ($? & 127) == 2 );
  16.         }
  17.  
  18.     }
  19.  
  20.     print "\n";
  21. }
  22.  
Advertisement
Add Comment
Please, Sign In to add comment