Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.user > #256867

Re: Is perl still the No.1 language for sysadmin?

From Emanuel Berg <incal@dataswamp.org>
Newsgroups linux.debian.user
Subject Re: Is perl still the No.1 language for sysadmin?
Date 2023-04-08 15:20 +0200
Message-ID <GigE1-Dst-5@gated-at.bofh.it> (permalink)
References (3 earlier) <GgjmF-gYSN-1@gated-at.bofh.it> <GgwDf-h7kC-1@gated-at.bofh.it> <GgwWB-h7GR-7@gated-at.bofh.it> <GgwWB-h7GR-5@gated-at.bofh.it> <GgxpD-h7Rr-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Michel Verdier wrote:

> #!/usr/bin/perl -w
>
> use strict;
>
> # echo $PATH | tr ':' '\n' | perl -MFile::Slurp -ne 'chomp;@e=read_dir($_,prefix=>1); print map "$_\n",@e'|xargs file|perl -pe 's/\S+\s+//'|grep -v 'symbolic link'|perl -pe 's/, dynamically linked.+//'|sort|uniq -c|sort -rn
>
> my @folders = split(':',$ENV{PATH});
> my %count;
>
> foreach my $folder (@folders) {
>     chomp($folder);
>     next if(-l $folder);
>     print "$folder\n";
>     opendir(DIR,"$folder");
>     my @files = readdir(DIR);
>     closedir DIR;
>     foreach my $file (@files) {
>         next if($file =~ /^\.\.?$/ or -l "$folder/$file");
>         chomp(my $type = `file -b $folder/$file`);
>         next if($type =~ /symbolic link/);
>         $type =~ s/,.+$//;
>         $count{$type}++;
>     }
> }
>
> foreach my $key (sort {$count{$b} <=> $count{$a}} keys %count) {
>     printf("%5d %s\n", $count{$key}, $key);
> }

First, the syntax is much nicer than Python ...

Question: Can you do everything with Perl, with zsh you can't
and it is annoying and you also feel silly asking people stuff
how you do that and putting them in a position they have to
say "You can't do that". With Lisp you can do everything,
I sort of got used to it, you know what I'm saying?

Check out my Perl BTW, is it any good? Not really, right?
Haha, ah, wrote it to get a job, one thousand years ago, and
didn't get it BTW, back then I always drank one beer before
the interviews to get relaxed, and one energy drink to get
focused LOL

Anyway here

  https://dataswamp.org/~incal/note_DB

So the syntax, maybe that's huge part of not liking
Python intuitively?

Man, to be honest I didn't know this focus on text with Perl,
if I had, maybe I would have done that from the start because
obviously that's something you do all the time.

But OTOH it was fun fiddling with awk, sed, perl ...

Ha, right, let me look that up, 2 instances ...

  perl -e '1 while 1'

What's that's suppose to mean? This file:
  https://dataswamp.org/~incal/conf/.zsh/cpu

And exact same line here (last).

Ah, it's like to stress the processor or something speaking of
CPU instructions.

Anyway what I wanted to say, since text processing is so
fundamental one is maybe recommended to learn great Perl
actually than to collect little fragments from awk, sed, perl
as a shell to LOL, that's why I don't write it with a capital
P, no, but really, I mean superficial use, instead learn
Pearl, in the list should also be included like zsh, not to
mention - I'll not mention them - all the shell tools.

Was it fun fiddling with them? Yes. Did it work? Yes, but not
really fluently. Does it ever? Well ... no :)

#! /bin/zsh
#
# this file:
#   https://dataswamp.org/~incal/conf/.zsh/temp

temp-gov () {
    local t=100

    local cpu
    local cpu_min
    local cpu_max

    perl -e '1 while 1' &
    local pid=$!
    sleep 10

    local i
    local g
    for g in $(cpufreq-info -g); do
        sudo cpufreq-set -g $g
        cpu_min=999
        cpu_max=0
        for i in {0..$t}; do
            cpu=$(sensors -j | jq -a '.["k10temp-pci-00c3"].Tdie.temp1_input')
            (( $cpu < $cpu_min )) && cpu_min=$cpu
            (( $cpu > $cpu_max )) && cpu_max=$cpu
        done
        printf "CPU C (%.2f %.2f) (%d iterations) %s\n" $cpu_min $cpu_max $t $g
    done

    kill $pid
}

temperature () {
    local cpu_min=999
    local gpu_min=999

    local cpu_max=0
    local gpu_max=0

    local cpu
    local gpu

    while true; do
        cpu=$(sensors -j | jq -a '.["k10temp-pci-00c3"].Tdie.temp2_input')
        gpu=$(sensors -j | jq -a '.["nouveau-pci-0100"].temp1.temp1_input')

        (( $cpu > $cpu_max )) && cpu_max=$cpu
        (( $gpu > $gpu_max )) && gpu_max=$gpu

        (( $cpu < $cpu_min )) && cpu_min=$cpu
        (( $gpu < $gpu_min )) && gpu_min=$gpu

        printf "CPU %.1fC (%.1f %.1f)\nGPU %.1fC (%.1f %.1f)\n\n" \
               $cpu $cpu_min $cpu_max                             \
               $gpu $gpu_min $gpu_max
        sleep 1
    done
}
alias {fan,fans}=temperature

-- 
underground experts united
https://dataswamp.org/~incal

Back to linux.debian.user | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Is perl still the No.1 language for sysadmin? coreyh@free.fr - 2023-04-02 11:00 +0200
  Re: Is perl still the No.1 language for sysadmin? <tomas@tuxteam.de> - 2023-04-02 11:10 +0200
  Re: Is perl still the No.1 language for sysadmin? Emanuel Berg <incal@dataswamp.org> - 2023-04-02 11:30 +0200
    Re: Is perl still the No.1 language for sysadmin? Jude DaShiell <jdashiel@panix.com> - 2023-04-02 11:50 +0200
    Re: Is perl still the No.1 language for sysadmin? Emanuel Berg <incal@dataswamp.org> - 2023-04-03 00:20 +0200
    Re: Is perl still the No.1 language for sysadmin? Steve Sobol <steve@LobosStudios.com> - 2023-04-03 00:20 +0200
  Re: Is perl still the No.1 language for sysadmin? Nicholas Geovanis <nickgeovanis@gmail.com> - 2023-04-02 18:40 +0200
    Re: Is perl still the No.1 language for sysadmin? <tomas@tuxteam.de> - 2023-04-02 18:40 +0200
      Re: Is perl still the No.1 language for sysadmin? Emanuel Berg <incal@dataswamp.org> - 2023-04-02 19:20 +0200
        Re: Is perl still the No.1 language for sysadmin? <tomas@tuxteam.de> - 2023-04-02 20:50 +0200
          Re: Is perl still the No.1 language for sysadmin? Emanuel Berg <incal@dataswamp.org> - 2023-04-02 21:00 +0200
            Re: Is perl still the No.1 language for sysadmin? Emanuel Berg <incal@dataswamp.org> - 2023-04-02 21:20 +0200
              Re: Is perl still the No.1 language for sysadmin? Emanuel Berg <incal@dataswamp.org> - 2023-04-02 21:30 +0200
              Re: Is perl still the No.1 language for sysadmin? debian-user@howorth.org.uk - 2023-04-03 00:00 +0200
                Re: Is perl still the No.1 language for sysadmin? Emanuel Berg <incal@dataswamp.org> - 2023-04-03 00:10 +0200
                Re: Is perl still the No.1 language for sysadmin? Steve Sobol <steve@LobosStudios.com> - 2023-04-03 01:10 +0200
                Re: Is perl still the No.1 language for sysadmin? David Christensen <dpchrist@holgerdanske.com> - 2023-04-03 04:30 +0200
                Re: Is perl still the No.1 language for sysadmin? Emanuel Berg <incal@dataswamp.org> - 2023-04-03 05:50 +0200
                Re: Is perl still the No.1 language for sysadmin? <tomas@tuxteam.de> - 2023-04-03 06:50 +0200
                Re: Is perl still the No.1 language for sysadmin? <tomas@tuxteam.de> - 2023-04-03 06:50 +0200
              Re: Is perl still the No.1 language for sysadmin? <tomas@tuxteam.de> - 2023-04-03 06:40 +0200
                Re: Is perl still the No.1 language for sysadmin? Emanuel Berg <incal@dataswamp.org> - 2023-04-03 11:30 +0200
                Re: Is perl still the No.1 language for sysadmin? Emanuel Berg <incal@dataswamp.org> - 2023-04-08 15:00 +0200
            Re: Is perl still the No.1 language for sysadmin? Greg Wooledge <greg@wooledge.org> - 2023-04-02 21:20 +0200
              Re: Is perl still the No.1 language for sysadmin? David Christensen <dpchrist@holgerdanske.com> - 2023-04-03 02:00 +0200
                Re: Is perl still the No.1 language for sysadmin? Ken Young <ken@highwinds.cloud> - 2023-04-03 02:30 +0200
        Re: Is perl still the No.1 language for sysadmin? David Christensen <dpchrist@holgerdanske.com> - 2023-04-03 01:40 +0200
    Re: Is perl still the No.1 language for sysadmin? Emanuel Berg <incal@dataswamp.org> - 2023-04-02 19:20 +0200
      Re: Is perl still the No.1 language for sysadmin? debian-user@howorth.org.uk - 2023-04-02 22:10 +0200
        Re: Is perl still the No.1 language for sysadmin? Emanuel Berg <incal@dataswamp.org> - 2023-04-02 22:40 +0200
          Re: Is perl still the No.1 language for sysadmin? Charles Curley <charlescurley@charlescurley.com> - 2023-04-02 23:20 +0200
        Re: Is perl still the No.1 language for sysadmin? Emanuel Berg <incal@dataswamp.org> - 2023-04-02 22:50 +0200
      Re: Is perl still the No.1 language for sysadmin? David Christensen <dpchrist@holgerdanske.com> - 2023-04-03 01:20 +0200
    Re: Is perl still the No.1 language for sysadmin? Michel Verdier <mv524@free.fr> - 2023-04-02 22:50 +0200
      Re: Is perl still the No.1 language for sysadmin? Tom Browder <tom.browder@gmail.com> - 2023-04-02 23:10 +0200
        Re: Is perl still the No.1 language for sysadmin? coreyh@free.fr - 2023-04-03 06:30 +0200
          Re: Is perl still the No.1 language for sysadmin? Andy Smith <andy@strugglers.net> - 2023-04-03 06:50 +0200
            Re: Is perl still the No.1 language for sysadmin? coreyh@free.fr - 2023-04-03 07:00 +0200
          Re: Is perl still the No.1 language for sysadmin? Stanislav Vlasov <stanislav.v.v@gmail.com> - 2023-04-03 08:50 +0200
            Re: Is perl still the No.1 language for sysadmin? David Christensen <dpchrist@holgerdanske.com> - 2023-04-03 09:30 +0200
              Re: Is perl still the No.1 language for sysadmin? Michel Verdier <mv524@free.fr> - 2023-04-03 10:40 +0200
              Re: Is perl still the No.1 language for sysadmin? Stanislav Vlasov <stanislav.v.v@gmail.com> - 2023-04-03 11:20 +0200
                Re: Is perl still the No.1 language for sysadmin? Michel Verdier <mv524@free.fr> - 2023-04-03 13:00 +0200
            Re: Is perl still the No.1 language for sysadmin? Vincent Lefevre <vincent@vinc17.net> - 2023-04-03 15:40 +0200
              Re: Is perl still the No.1 language for sysadmin? Stanislav Vlasov <stanislav.v.v@gmail.com> - 2023-04-03 18:50 +0200
      Re: Is perl still the No.1 language for sysadmin? Oliver Schoede <oliver.schode@online.de> - 2023-04-02 23:40 +0200
        Re: Is perl still the No.1 language for sysadmin? Emanuel Berg <incal@dataswamp.org> - 2023-04-03 00:10 +0200
        Re: Is perl still the No.1 language for sysadmin? David Christensen <dpchrist@holgerdanske.com> - 2023-04-03 03:30 +0200
        Re: Is perl still the No.1 language for sysadmin? Andy Smith <andy@strugglers.net> - 2023-04-03 05:00 +0200
          Re: Is perl still the No.1 language for sysadmin? Emanuel Berg <incal@dataswamp.org> - 2023-04-03 05:50 +0200
            Re: Is perl still the No.1 language for sysadmin? Andy Smith <andy@strugglers.net> - 2023-04-03 06:20 +0200
              Re: Is perl still the No.1 language for sysadmin? Emanuel Berg <incal@dataswamp.org> - 2023-04-04 02:20 +0200
                Re: Is perl still the No.1 language for sysadmin? local10 <local10@tutanota.com> - 2023-04-04 05:40 +0200
                Re: Is perl still the No.1 language for sysadmin? Andy Smith <andy@strugglers.net> - 2023-04-04 15:50 +0200
                Re: Is perl still the No.1 language for sysadmin? local10 <local10@tutanota.com> - 2023-04-05 00:50 +0200
      Re: Is perl still the No.1 language for sysadmin? Jude DaShiell <jdashiel@panix.com> - 2023-04-03 00:10 +0200
        Re: Is perl still the No.1 language for sysadmin? Emanuel Berg <incal@dataswamp.org> - 2023-04-03 00:20 +0200
    Re: Is perl still the No.1 language for sysadmin? David Christensen <dpchrist@holgerdanske.com> - 2023-04-03 01:20 +0200
      Re: Is perl still the No.1 language for sysadmin? Emanuel Berg <incal@dataswamp.org> - 2023-04-03 02:20 +0200
        Re: Is perl still the No.1 language for sysadmin? Eduard Bloch <edi@gmx.de> - 2023-04-03 23:30 +0200
          Re: Is perl still the No.1 language for sysadmin? Joel Roth <joelz@pobox.com> - 2023-04-04 00:30 +0200
            Re: Is perl still the No.1 language for sysadmin? Emanuel Berg <incal@dataswamp.org> - 2023-04-08 16:20 +0200
          Re: Is perl still the No.1 language for sysadmin? Emanuel Berg <incal@dataswamp.org> - 2023-04-08 16:00 +0200
            Re: Is perl still the No.1 language for sysadmin? rhkramer@gmail.com - 2023-04-08 16:30 +0200
              Re: Is perl still the No.1 language for sysadmin? Greg Wooledge <greg@wooledge.org> - 2023-04-08 18:30 +0200
                Re: Is perl still the No.1 language for sysadmin? Emanuel Berg <incal@dataswamp.org> - 2023-04-08 18:40 +0200
                Re: Is perl still the No.1 language for sysadmin? Emanuel Berg <incal@dataswamp.org> - 2023-04-08 18:50 +0200
                Re: Is perl still the No.1 language for sysadmin? "Thomas Schmitt" <scdbackup@gmx.net> - 2023-04-08 19:50 +0200
                Re: Is perl still the No.1 language for sysadmin? rhkramer@gmail.com - 2023-04-08 21:20 +0200
                Re: Is perl still the No.1 language for sysadmin? Emanuel Berg <incal@dataswamp.org> - 2023-04-08 21:40 +0200
                Re: Is perl still the No.1 language for sysadmin? Max Nikulin <manikulin@gmail.com> - 2023-04-09 05:40 +0200
        Re: Is perl still the No.1 language for sysadmin? Tom Dial <tddial@comcast.net> - 2023-04-04 04:00 +0200
          Re: Is perl still the No.1 language for sysadmin? Emanuel Berg <incal@dataswamp.org> - 2023-04-08 16:20 +0200
            Re: Is perl still the No.1 language for sysadmin? davidson <davidson@freevolt.org> - 2023-04-08 16:50 +0200
              Re: Is perl still the No.1 language for sysadmin? Emanuel Berg <incal@dataswamp.org> - 2023-04-08 17:10 +0200
            Re: Is perl still the No.1 language for sysadmin? Tom Dial <tddial@comcast.net> - 2023-04-11 04:20 +0200
          Re: Is perl still the No.1 language for sysadmin? Emanuel Berg <incal@dataswamp.org> - 2023-04-08 16:30 +0200
        Re: Is perl still the No.1 language for sysadmin? Celejar <celejar@gmail.com> - 2023-04-05 04:10 +0200
          Re: Is perl still the No.1 language for sysadmin? Emanuel Berg <incal@dataswamp.org> - 2023-04-08 16:50 +0200
  Re: Is perl still the No.1 language for sysadmin? David Christensen <dpchrist@holgerdanske.com> - 2023-04-02 23:20 +0200
    Re: Is perl still the No.1 language for sysadmin? ghe2001 <ghe2001@protonmail.com> - 2023-04-02 23:40 +0200
      Re: Is perl still the No.1 language for sysadmin? Emanuel Berg <incal@dataswamp.org> - 2023-04-02 23:50 +0200
        Re: Is perl still the No.1 language for sysadmin? Michel Verdier <mv524@free.fr> - 2023-04-03 00:10 +0200
    Re: Is perl still the No.1 language for sysadmin? Emanuel Berg <incal@dataswamp.org> - 2023-04-02 23:40 +0200
      Re: Is perl still the No.1 language for sysadmin? David Christensen <dpchrist@holgerdanske.com> - 2023-04-03 05:50 +0200
        Re: Is perl still the No.1 language for sysadmin? Emanuel Berg <incal@dataswamp.org> - 2023-04-03 20:00 +0200
          Re: Is perl still the No.1 language for sysadmin? Emanuel Berg <incal@dataswamp.org> - 2023-04-03 20:20 +0200
            Re: Is perl still the No.1 language for sysadmin? Michel Verdier <mv524@free.fr> - 2023-04-03 20:50 +0200
              Re: Is perl still the No.1 language for sysadmin? Emanuel Berg <incal@dataswamp.org> - 2023-04-08 15:20 +0200
          Re: Is perl still the No.1 language for sysadmin? Michel Verdier <mv524@free.fr> - 2023-04-03 20:20 +0200
          Re: Is perl still the No.1 language for sysadmin? Greg Wooledge <greg@wooledge.org> - 2023-04-03 20:50 +0200
            Re: Is perl still the No.1 language for sysadmin? Michel Verdier <mv524@free.fr> - 2023-04-03 21:00 +0200
              Re: Is perl still the No.1 language for sysadmin? davidson <davidson@freevolt.org> - 2023-04-08 05:50 +0200
                Re: Is perl still the No.1 language for sysadmin? Emanuel Berg <incal@dataswamp.org> - 2023-04-08 15:40 +0200
            Re: Is perl still the No.1 language for sysadmin? David Christensen <dpchrist@holgerdanske.com> - 2023-04-03 22:00 +0200
              Re: Is perl still the No.1 language for sysadmin? Greg Wooledge <greg@wooledge.org> - 2023-04-03 22:10 +0200
                Re: Is perl still the No.1 language for sysadmin? David Christensen <dpchrist@holgerdanske.com> - 2023-04-03 22:30 +0200
                Re: Is perl still the No.1 language for sysadmin? Michael <ml@hemathor.de> - 2023-04-05 12:00 +0200
                Re: Is perl still the No.1 language for sysadmin? Michael <ml@hemathor.de> - 2023-04-05 12:00 +0200
                Re: Is perl still the No.1 language for sysadmin? Nicolas George <george@nsup.org> - 2023-04-05 12:10 +0200
                Re: Is perl still the No.1 language for sysadmin? Greg Wooledge <greg@wooledge.org> - 2023-04-05 13:30 +0200
                Re: Is perl still the No.1 language for sysadmin? <tomas@tuxteam.de> - 2023-04-05 13:40 +0200
                Re: Is perl still the No.1 language for sysadmin? Nicolas George <george@nsup.org> - 2023-04-05 14:00 +0200
                Re: Is perl still the No.1 language for sysadmin? Greg Wooledge <greg@wooledge.org> - 2023-04-05 14:20 +0200
                Re: Is perl still the No.1 language for sysadmin? Nicolas George <george@nsup.org> - 2023-04-05 13:40 +0200
          Re: Is perl still the No.1 language for sysadmin? David Christensen <dpchrist@holgerdanske.com> - 2023-04-03 21:50 +0200
  Re: Is perl still the No.1 language for sysadmin? Andy Smith <andy@strugglers.net> - 2023-04-03 05:10 +0200
  Re: Is perl still the No.1 language for sysadmin? Jeffrey Walton <noloader@gmail.com> - 2023-04-03 18:40 +0200
    Re: Is perl still the No.1 language for sysadmin? Stanislav Vlasov <stanislav.v.v@gmail.com> - 2023-04-03 19:10 +0200
      Re: Is perl still the No.1 language for sysadmin? Michel Verdier <mv524@free.fr> - 2023-04-03 19:40 +0200
        Re: Is perl still the No.1 language for sysadmin? Emanuel Berg <incal@dataswamp.org> - 2023-04-03 19:50 +0200
    Re: Is perl still the No.1 language for sysadmin? debian-user@howorth.org.uk - 2023-04-03 19:20 +0200
      Re: Is perl still the No.1 language for sysadmin? Emanuel Berg <incal@dataswamp.org> - 2023-04-03 19:50 +0200
    Re: Is perl still the No.1 language for sysadmin? Emanuel Berg <incal@dataswamp.org> - 2023-04-03 19:40 +0200
      Re: Is perl still the No.1 language for sysadmin? "Thomas Schmitt" <scdbackup@gmx.net> - 2023-04-03 20:30 +0200
        Re: Is perl still the No.1 language for sysadmin? Emanuel Berg <incal@dataswamp.org> - 2023-04-08 15:10 +0200
          Re: Is perl still the No.1 language for sysadmin? Greg Wooledge <greg@wooledge.org> - 2023-04-08 15:20 +0200
            Re: Is perl still the No.1 language for sysadmin? Emanuel Berg <incal@dataswamp.org> - 2023-04-08 15:30 +0200
        Re: Is perl still the No.1 language for sysadmin? Andy Smith <andy@strugglers.net> - 2023-04-09 00:20 +0200
          Re: Is perl still the No.1 language for sysadmin? conover@panix.com (John Conover) - 2023-04-09 05:00 +0200
      Re: Is perl still the No.1 language for sysadmin? Jeffrey Walton <noloader@gmail.com> - 2023-04-04 15:40 +0200
        Re: Is perl still the No.1 language for sysadmin? Stefan Monnier <monnier@iro.umontreal.ca> - 2023-04-04 15:50 +0200
          Re: Is perl still the No.1 language for sysadmin? Jeffrey Walton <noloader@gmail.com> - 2023-04-04 16:40 +0200
            Re: Is perl still the No.1 language for sysadmin? debian-user@howorth.org.uk - 2023-04-04 19:40 +0200
              Re: Is perl still the No.1 language for sysadmin? Greg Wooledge <greg@wooledge.org> - 2023-04-04 19:40 +0200
                Re: Is perl still the No.1 language for sysadmin? David Wright <deblis@lionunicorn.co.uk> - 2023-04-04 20:00 +0200
                Re: Is perl still the No.1 language for sysadmin? Jeffrey Walton <noloader@gmail.com> - 2023-04-04 21:00 +0200
                Re: Is perl still the No.1 language for sysadmin? Emanuel Berg <incal@dataswamp.org> - 2023-04-08 16:40 +0200
                Re: Is perl still the No.1 language for sysadmin? Emanuel Berg <incal@dataswamp.org> - 2023-04-08 16:40 +0200
              Re: Is perl still the No.1 language for sysadmin? Emanuel Berg <incal@dataswamp.org> - 2023-04-08 16:50 +0200
          Re: Is perl still the No.1 language for sysadmin? Emanuel Berg <incal@dataswamp.org> - 2023-04-08 17:00 +0200
        Re: Is perl still the No.1 language for sysadmin? Emanuel Berg <incal@dataswamp.org> - 2023-04-08 17:10 +0200
    Computer anthropology and language wars [was: Is perl still the No.1  language for sysadmin?] <tomas@tuxteam.de> - 2023-04-03 19:50 +0200

csiph-web