<div dir="ltr">I cant resist a bit of golf:<div><br></div><div>dpkg --get-selections | awk '{print $1}' | sort -R | head -1<br></div><div><br></div><div>Donovan</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">
On Thu, Feb 13, 2014 at 6:23 AM, Brent Wood <span dir="ltr"><<a href="mailto:pcreso@pcreso.com" target="_blank">pcreso@pcreso.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div><div style="font-size:12pt;font-family:arial,helvetica,sans-serif"><div><span>And a wellylug equivalent to the perlmongers solution by Grant for selecting a random package on a Debian based Linux system:-)<br></span></div>
<div><br></div><div>dpkg --get-selections | tail -n `rand -M \`dpkg --get-selections | wc -l\`` | head -1</div><div><br></div><div style="font-style:normal;font-size:16px;background-color:transparent;font-family:arial,helvetica,sans-serif">
I figured you should be able to do this with common Linux commands, without resorting to a programming or scripting language.</div><div style="font-style:normal;font-size:16px;background-color:transparent;font-family:arial,helvetica,sans-serif">
This is one way...<br></div><div style="font-style:normal;font-size:16px;background-color:transparent;font-family:arial,helvetica,sans-serif"><br></div><div style="font-style:normal;font-size:16px;background-color:transparent;font-family:arial,helvetica,sans-serif">
If I thought about it a bit more I figure awk could probably do this a bit more elegantly, if not even more arcanely!.<br></div><div style="font-style:normal;font-size:16px;background-color:transparent;font-family:arial,helvetica,sans-serif">
<br></div><div style="font-style:normal;font-size:16px;background-color:transparent;font-family:arial,helvetica,sans-serif"><br></div><div style="font-style:normal;font-size:16px;background-color:transparent;font-family:arial,helvetica,sans-serif">
Brent<br></div> <div style="font-family:arial,helvetica,sans-serif;font-size:12pt"> <div style="font-family:times new roman,new york,times,serif;font-size:12pt"> <div dir="ltr"> <hr size="1"> <font face="Arial"> <b><span style="font-weight:bold">From:</span></b> Grant McLean <<a href="mailto:grant@mclean.net.nz" target="_blank">grant@mclean.net.nz</a>><br>
<b><span style="font-weight:bold">To:</span></b> <a href="mailto:wellylug@lists.wellylug.org.nz" target="_blank">wellylug@lists.wellylug.org.nz</a> <br> <b><span style="font-weight:bold">Sent:</span></b> Wednesday, February 12, 2014 3:50 PM<br>
<b><span style="font-weight:bold">Subject:</span></b> Re: [wellylug] If you are stuck for ideas for a lightning talk session<br> </font> </div><div><div class="h5"> <div><br>Presumably the WellyLUG session on Monday will take a relaxed approach<br clear="none">
to the five minute time limit (as the Perl Mongers did last night) so<br clear="none">the dire warnings in that page can be ignored.<br clear="none"><br clear="none">Also, I'm guessing that people with slides will either bring their own<br clear="none">
laptop or put them on a web page. Bringing PDF/OpenOffice/HTML files on<br clear="none">a USB stick could also work.<br clear="none"><br clear="none">The suggestion on our page that people might randomly select a Perl<br clear="none">
module to talk about could be adapted to "randomly select an OS<br clear="none">package". For example on a debian-based distro, this 1-liner will<br clear="none">randomly select one of the packages you have installed:<br clear="none">
<br clear="none"> dpkg --get-selections | \<br clear="none"> perl -E '@p = map { s/\s.*//r } <>; say $p[rand(+@p)]'<br clear="none"><br clear="none">See you Monday.<br clear="none"><br clear="none">Cheers<br clear="none">
Grant<br clear="none"><br clear="none"><div><br clear="none">On Wed, 2014-02-12 at 15:14 +1300, Hugh Davenport wrote:<br clear="none">> Graciously stolen from Wellington Perl Mongers, who had a<br clear="none">> lightning session last night.<br clear="none">
> <br clear="none">> <a shape="rect" href="http://wellington.pm.org/lightning_talks.html" target="_blank">http://wellington.pm.org/lightning_talks.html</a><br clear="none">> <br clear="none">> I shall add this to the WellyLUG page at some point.<br clear="none">
> <br clear="none">> Let me know if you get a spark of ideas for a talk next monday!<br clear="none">> <br clear="none">> Cheers,<br clear="none">> <br clear="none">> Hugh<br clear="none">> <br clear="none">
> <br clear="none"><br clear="none"><br clear="none"><br clear="none">-- <br clear="none">Wellington Linux Users Group Mailing List: <a shape="rect" href="mailto:wellylug@lists.wellylug.org.nz" target="_blank">wellylug@lists.wellylug.org.nz</a><br clear="none">
To Leave: <a shape="rect" href="http://lists.wellylug.org.nz/mailman/listinfo/wellylug" target="_blank">http://lists.wellylug.org.nz/mailman/listinfo/wellylug</a><br clear="none"></div><br><br></div> </div></div></div>
</div> </div></div><br><br>
--<br>
Wellington Linux Users Group Mailing List: <a href="mailto:wellylug@lists.wellylug.org.nz">wellylug@lists.wellylug.org.nz</a><br>
To Leave: <a href="http://lists.wellylug.org.nz/mailman/listinfo/wellylug" target="_blank">http://lists.wellylug.org.nz/mailman/listinfo/wellylug</a><br>
<br></blockquote></div><br></div>