Latest recipes tagged "perl"http://code.activestate.com/recipes/tags/perl/new/2017-02-23T22:38:50-08:00ActiveState Code RecipesSimulating an unless (reverse if) statement in Python (Python) 2017-02-23T22:38:50-08:00Vasudev Ramhttp://code.activestate.com/recipes/users/4173351/http://code.activestate.com/recipes/580758-simulating-an-unless-reverse-if-statement-in-pytho/ <p style="color: grey"> Python recipe 580758 by <a href="/recipes/users/4173351/">Vasudev Ram</a> (<a href="/recipes/tags/features/">features</a>, <a href="/recipes/tags/if/">if</a>, <a href="/recipes/tags/perl/">perl</a>, <a href="/recipes/tags/programming/">programming</a>, <a href="/recipes/tags/python/">python</a>, <a href="/recipes/tags/trick/">trick</a>). </p> <p>This recipe shows how to simulate an unless statement (a sort of reverse if, like Perl has), in Python. It is just for fun and as an experiment, not meant for real use, because the effect of unless can easily be got by negating the sense of the condition in an if statement.</p> <p>More details and output here:</p> <p><a href="https://jugad2.blogspot.in/2017/02/perl-like-unless-reverse-if-feature-in.html" rel="nofollow">https://jugad2.blogspot.in/2017/02/perl-like-unless-reverse-if-feature-in.html</a></p> Get all installed Windows hotfixes (Perl) 2014-07-31T17:33:19-07:00Brett Carrollhttp://code.activestate.com/recipes/users/4174322/http://code.activestate.com/recipes/578917-get-all-installed-windows-hotfixes/ <p style="color: grey"> Perl recipe 578917 by <a href="/recipes/users/4174322/">Brett Carroll</a> (<a href="/recipes/tags/engineering/">engineering</a>, <a href="/recipes/tags/fix/">fix</a>, <a href="/recipes/tags/hotfix/">hotfix</a>, <a href="/recipes/tags/hotfixes/">hotfixes</a>, <a href="/recipes/tags/ole/">ole</a>, <a href="/recipes/tags/perl/">perl</a>, <a href="/recipes/tags/quick/">quick</a>, <a href="/recipes/tags/win32/">win32</a>, <a href="/recipes/tags/windows/">windows</a>, <a href="/recipes/tags/wmi/">wmi</a>). </p> <p>This script uses WMI (via Win32::OLE) to retrieve and print out a comma separated list of all installed Windows hotfixes.</p> Send a message to remote syslog server (Perl) 2014-07-31T17:23:17-07:00Brett Carrollhttp://code.activestate.com/recipes/users/4174322/http://code.activestate.com/recipes/578916-send-a-message-to-remote-syslog-server/ <p style="color: grey"> Perl recipe 578916 by <a href="/recipes/users/4174322/">Brett Carroll</a> (<a href="/recipes/tags/perl/">perl</a>, <a href="/recipes/tags/syslog/">syslog</a>, <a href="/recipes/tags/unix/">unix</a>). Revision 2. </p> <p>This script allows sending syslog messages to a remote syslog server (UNIX).</p> Multiple host/ip DNS resolution - mass_nslookup.pl (Perl) 2014-07-31T17:11:03-07:00Brett Carrollhttp://code.activestate.com/recipes/users/4174322/http://code.activestate.com/recipes/578915-multiple-hostip-dns-resolution-mass_nslookuppl/ <p style="color: grey"> Perl recipe 578915 by <a href="/recipes/users/4174322/">Brett Carroll</a> (<a href="/recipes/tags/address/">address</a>, <a href="/recipes/tags/digg/">digg</a>, <a href="/recipes/tags/dns/">dns</a>, <a href="/recipes/tags/hostname/">hostname</a>, <a href="/recipes/tags/ip/">ip</a>, <a href="/recipes/tags/nslookup/">nslookup</a>, <a href="/recipes/tags/perl/">perl</a>). </p> <p>Parse a text file containing a list of IP Addresses or hostnames (one per line) and print out the corresponding IP Address or hostname resolved by DNS.</p> Benchmark (PHP) 2015-06-26T04:30:14-07:00Roger Mbiama Assogohttp://code.activestate.com/recipes/users/4178746/http://code.activestate.com/recipes/578235-benchmark/ <p style="color: grey"> PHP recipe 578235 by <a href="/recipes/users/4178746/">Roger Mbiama Assogo</a> (<a href="/recipes/tags/perl/">perl</a>, <a href="/recipes/tags/ppi/">ppi</a>, <a href="/recipes/tags/scripts/">scripts</a>, <a href="/recipes/tags/vim/">vim</a>). Revision 6. </p> <p>perl [ -sTtuUWX ] [ -hv ] [ -V[:configvar] ] [ -cw ] [ -d[t][:debugger] ] [ -D[number/list] ] [ -pna ] [ -Fpattern ] [ -l[octal] ] [ -0[octal/hexadecimal] ] [ -Idir ] [ -m[-]module ] [ -M[-]'module...' ] [ -f ] [ -C [number/list] ] [ -S ] [ -x[dir] ] [ -i[extension] ] [ [-e|-E] 'command' ] [ -- ] [ programfile ] [ argument ] [stap -L 'kernel.trace("*")'|sort] [feature]... BEGIN { my $b__dir = (-d '/home/angosson/perl'?'/var/www/cgi-bin/perl':( getpwuid($&gt;) )[7].'/perl');</p> <pre class="prettyprint"><code>unshift @INC,$b__dir.'5/lib/perl5',$b__dir.'5/lib/perl5/x86_64-linux-thread-multi',map { $b__dir . $_ } @INC; </code></pre> <p>} require LWP::UserAgent;</p> <p>my $ua = LWP::UserAgent-&gt;new; $ua-&gt;timeout(10); $ua-&gt;env_proxy;</p> Pyliner - Script to run arbitrary Python code on the command line (Python) 2011-07-29T13:22:54-07:00Drew Gulinohttp://code.activestate.com/recipes/users/4119417/http://code.activestate.com/recipes/577075-pyliner-script-to-run-arbitrary-python-code-on-the/ <p style="color: grey"> Python recipe 577075 by <a href="/recipes/users/4119417/">Drew Gulino</a> (<a href="/recipes/tags/awk/">awk</a>, <a href="/recipes/tags/oneliner/">oneliner</a>, <a href="/recipes/tags/perl/">perl</a>, <a href="/recipes/tags/pipe/">pipe</a>, <a href="/recipes/tags/python/">python</a>, <a href="/recipes/tags/sed/">sed</a>, <a href="/recipes/tags/sysadmin/">sysadmin</a>). </p> <p>A Python script that runs arbitrary Python scripts in an input loop. This allows one-liner Python scripts similarly to how Perl runs them (-l,-a,-n,-F, BEGIN, END)</p> <p>It provides additional syntax that allows multiline Python scripts to be run on a single line</p>