Re: Just wrote my first Perl script
On Tue, Jul 14, 2015 at 04:04:07PM +, Matthew Harris wrote: Nice to see that people are still learning Perl! I'll see some code! Yeah, but note that there exist standard Perl modules for IP address mangling, so it is not needed to write that yourself (except for fun and/or study purposes). Nothing wrong with Perl, but I highly prefer Python these days ;-). -- --Jos Vos j...@xos.nl --X/OS Experts in Open Systems BV | Phone: +31 20 6938364 --Amsterdam, The Netherlands| Fax: +31 20 6948204
Re: Just wrote my first Perl script
Nice to see that people are still learning Perl! I'll see some code! Matthew Harris | Automation Engineer​ | IPsoft, Austin From: owner-scientific-linux-us...@listserv.fnal.gov owner-scientific-linux-us...@listserv.fnal.gov on behalf of Vladimir Mosgalin mosga...@vm10124.spb.edu Sent: Tuesday, July 14, 2015 9:34 AM To: scientific-linux-users@fnal.gov Subject: Re: Just wrote my first Perl script Hi ToddAndMargo! On 2015.07.14 at 00:14:02 -0700, ToddAndMargo wrote next: Well you need to add ipv6 support and long mask support and broadcast address calculation to it and you'll get close to the features of ipcalc command :) I just wrote my first Perl script. I calculates your network for you from your IP and your short mark. If any one wants it, I will post it. -T $ GetNetwork.pl 192.198.255.147 28 192.198.255.144 -- ~~ Computers are like air conditioners. They malfunction when you open windows ~~ -- Vladimir
Re: SL 7.2
On 07/07/2015 10:25 PM, Nico Kadel-Garcia wrote: And Larry, where is your code base for Spice? Is it RPM based? Because I find several different spice software packages for SL 6, none of which are the CAD circuitry software. ngspice is probably what is being talked about, although GNUCAP is also out there. Much of the upstream Fedora EDA tools will be difficult to pull over to EPEL for 7; I'm trying to get a recent kicad built myself, and it wants boost 1.54+ among other things. The source RPM for kicad that shipped with Fedora 20 builds ok, but the source RPMs for Fedoras 21 and 22 do not.
Re: Just wrote my first Perl script
I just wrote my first Perl script. I calculates your network for you from your IP and your short mark. If any one wants it, I will post it. -T $ GetNetwork.pl 192.198.255.147 28 192.198.255.144 On 07/14/2015 07:34 AM, Vladimir Mosgalin wrote: Hi ToddAndMargo! On 2015.07.14 at 00:14:02 -0700, ToddAndMargo wrote next: Well you need to add ipv6 support and long mask support and broadcast address calculation to it and you'll get close to the features of ipcalc command :) Hi Vladimir, You know, I have never actually seen an IPv6 installation. I use this script to set up my firewall iptables. eth1_net=$NETWORK/$ETH1_MASK $tbls -A dsl-in -j DROP -i eth1 -s $eth1_net -d $ANY_IP I suppose at some point I will have to learn IPv6. Right now I am going at Perl, which I now see why your guys like it! -T
Re: Just wrote my first Perl script
On 07/14/2015 09:15 AM, Jos Vos wrote: On Tue, Jul 14, 2015 at 04:04:07PM +, Matthew Harris wrote: Nice to see that people are still learning Perl! I'll see some code! Yeah, but note that there exist standard Perl modules for IP address mangling, so it is not needed to write that yourself (except for fun and/or study purposes). Perl is a Swiss Army knife. I wrote this to force myself to learn perl. That and I need it for my firewall tables. Nothing wrong with Perl, but I highly prefer Python these days ;-). Python. Maybe someday ...
Re: Just wrote my first Perl script
On 07/14/2015 09:04 AM, Matthew Harris wrote: Nice to see that people are still learning Perl! I'll see some code! Hi Matthew, Seems to me like you can do anything in Perl. It is sweet. Here is the code. I use this for system administration (a lot of us here), specifically yo set up my firewall. You will love the equation to go from Short Mask to Hex Mask. A guy on the Perl group helped me with it and I have no idea how he figured it out. $HexMask = ~((1 (32 - $ShortMask)) - 1); Wow. Took me forever to understand what he did! -T GetNetwork.pl code #!/usr/bin/perl # Given the ip and the short mask in the form of # www.xxx.yyy.zz and xx, e.g. 192.168.244.134 26 # calculate the network use strict; use warnings; # You'll get little help here without these my ( $ScriptName, $ip, $ShortMask, $HexIP, $HexMask, $NetworkDots, $num_args, $Network ); ( $ScriptName = $0 ) =~ s{.*/}{}; # quit unless we have the correct number of command-line args $num_args = $#ARGV + 1; if ($num_args != 2) { print You forgot something\n; print Usage: $ScriptName IP ShortMask\n\n; exit 1; } $ip=$ARGV[0]; $ShortMask=$ARGV[1]; if ($ip =~ m/(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})/ ) { # print $1 $2 $3 $4\n; if ($1 255 || $2 255 || $3 255 || $4 255 ) { print Invalid ip $ip\n; exit 1; } $HexIP = ($1 24) + ($2 16) + ($3 8) + $4; } $HexMask = ~((1 (32 - $ShortMask)) - 1); $Network = $HexIP $HexMask; # is a bit wise AND $NetworkDots= ($Network 24) . . . (($Network 16 ) 0xFF) . . . (($Network 8 ) 0xFF ) . . . ($Network 0xFF ); # print Your network for ip=$ip and Netmask=$ShortMask is $NetworkDots\n; print $NetworkDots\n; /code
Re: Just wrote my first Perl script
Plz send me in zip On Jul 15, 2015 8:11 AM, Matthew Harris matthew.har...@ipsoft.com wrote: Oh wow, yeah any time were pulling out bitwise operators I'm using a CPAN module. See http://search.cpan.org/~muir/Net-Netmask-1.9015/Netmask.pod But congrats and keep up the learning! Matthew Harris | Automation Engineer​ | IPsoft, Austin Phone: 888.IPSOFT8 | Direct: 512-354-8116 | matthew.har...@ipsoft.com From: owner-scientific-linux-us...@listserv.fnal.gov owner-scientific-linux-us...@listserv.fnal.gov on behalf of ToddAndMargo toddandma...@zoho.com Sent: Tuesday, July 14, 2015 2:31 PM To: scientific-linux-users@fnal.gov Subject: Re: Just wrote my first Perl script On 07/14/2015 09:04 AM, Matthew Harris wrote: Nice to see that people are still learning Perl! I'll see some code! Hi Matthew, Seems to me like you can do anything in Perl. It is sweet. Here is the code. I use this for system administration (a lot of us here), specifically yo set up my firewall. You will love the equation to go from Short Mask to Hex Mask. A guy on the Perl group helped me with it and I have no idea how he figured it out. $HexMask = ~((1 (32 - $ShortMask)) - 1); Wow. Took me forever to understand what he did! -T GetNetwork.pl code #!/usr/bin/perl # Given the ip and the short mask in the form of # www.xxx.yyy.zz and xx, e.g. 192.168.244.134 26 # calculate the network use strict; use warnings; # You'll get little help here without these my ( $ScriptName, $ip, $ShortMask, $HexIP, $HexMask, $NetworkDots, $num_args, $Network ); ( $ScriptName = $0 ) =~ s{.*/}{}; # quit unless we have the correct number of command-line args $num_args = $#ARGV + 1; if ($num_args != 2) { print You forgot something\n; print Usage: $ScriptName IP ShortMask\n\n; exit 1; } $ip=$ARGV[0]; $ShortMask=$ARGV[1]; if ($ip =~ m/(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})/ ) { # print $1 $2 $3 $4\n; if ($1 255 || $2 255 || $3 255 || $4 255 ) { print Invalid ip $ip\n; exit 1; } $HexIP = ($1 24) + ($2 16) + ($3 8) + $4; } $HexMask = ~((1 (32 - $ShortMask)) - 1); $Network = $HexIP $HexMask; # is a bit wise AND $NetworkDots= ($Network 24) . . . (($Network 16 ) 0xFF) . . . (($Network 8 ) 0xFF ) . . . ($Network 0xFF ); # print Your network for ip=$ip and Netmask=$ShortMask is $NetworkDots\n; print $NetworkDots\n; /code
Re: SL 7.2
On Tue, Jul 14, 2015 at 5:11 PM, Nico Kadel-Garcia nka...@gmail.com wrote: I'm getting more and more inclined to give SL 7 a complete miss, and see if SL 8 will be contemporary enough to ease my backporting work. Or switch to a distribution with an explicit policy of we will never adopt systemd. Do you know of any? This is perhaps not a sufficient condition to have maintainers without their heads up their backsides, but it is surely a necessary one. - Pat