™ Develop Feature- Rich Apps with Command-Line Tools OCTOBER 2017 | ISSUE 282 Since 1994: The Original Magazine of the Linux Community http://www.linuxjournal.com PROGRAMMING Scripting Project with Bash and PHP + How to Use Threading in Python Introducing Subutai, a New Kind of Cloud Ubuntu and Bash as a Windows Program WATCH: ISSUE OVERVIEW V LJ282-Oct2017.indd 1 9/19/17 3:40 PM An Architect’s SQL Server Guide: Linux on Linux in the Age Author: Practical books of Containers Reuven M. Lerner Author: Sponsor: Sol Lederman SUSE for the most technical Sponsor: people on the planet. SUSE Managing Harnessing Container the Power Security and of the Cloud Compliance with SUSE in Docker GEEK GUIDES Author: Author: Petros Koutoupis Petros Koutoupis Sponsor: Sponsor: SUSE Twistlock DevOps for An the Rest of Us Architect’s Author: Guide: John S. Tonello Linux for Sponsor: Enterprise IT Puppet Author: Sol Lederman Sponsor: SUSE Download books for free with a Memory: Past, Cloud-Scale simple one-time registration. Present and Automation Future—and with Puppet the Tools to Author: http://geekguide.linuxjournal.com Optimize It John S. Tonello Author: Sponsor: Petros Koutoupis Puppet Sponsor: Intel LJ282-Oct2017.indd 2 9/19/17 3:40 PM An Architect’s SQL Server Guide: Linux on Linux in the Age Author: Practical books of Containers Reuven M. Lerner Author: Sponsor: Sol Lederman SUSE for the most technical Sponsor: people on the planet. SUSE Managing Harnessing Container the Power Security and of the Cloud Compliance with SUSE in Docker GEEK GUIDES Author: Author: Petros Koutoupis Petros Koutoupis Sponsor: Sponsor: SUSE Twistlock DevOps for An the Rest of Us Architect’s Author: Guide: John S. Tonello Linux for Sponsor: Enterprise IT Puppet Author: Sol Lederman Sponsor: SUSE Download books for free with a Memory: Past, Cloud-Scale simple one-time registration. Present and Automation Future—and with Puppet the Tools to Author: http://geekguide.linuxjournal.com Optimize It John S. Tonello Author: Sponsor: Petros Koutoupis Puppet Sponsor: Intel LJ282-Oct2017.indd 3 9/19/17 3:40 PM OCTOBER 2017 CONTENTS ISSUE 282 FEATURES 68 Cool Project: 86 Developing Create a CAPTCHA Console for Your Website Applications If your friends and family can with Bash !nd the photo of your cat from Develop feature-rich nine random cat photos, you applications using standard can let them in to your website. command-line tools. Jim Hall Andy Carlson Cover Image: © Can Stock Photo / undrey 4 | October 2017 | http://www.linuxjournal.com LJ282-Oct2017.indd 4 9/19/17 3:40 PM CONTENTS COLUMNS 30 Reuven M. Lerner’s At the Forge Threading in Python 38 Dave Taylor’s Work the Shell Ubuntu Linux and Bash as a Windows Program! 20 46 Kyle Rankin’s Hack and / On-Call or Travel Laptops 50 Shawn Powers’ The Open-Source Classroom Ansible, Part III: Playbooks 98 Guest EOF Say Hi to Subutai Alex Karasulu (with help from Jon ’maddog’ Hall, Philip Sheldrake and Steve Taylor) IN EVERY ISSUE 68 8 Current_Issue.tar.gz 10 UPFRONT ON THE COVER UÊ iÛi«Êi>ÌÕÀi,V Ê««ÃÊÜÌ Ê >`iÊ/Ã]Ê«°ÊnÈ 28 Editors’ Choice UÊ-VÀ«Ì}Ê*ÀiVÌÊÜÌ Ê >à Ê>`Ê**]Ê«°ÊÈn UÊÜÊÌÊ1ÃiÊ/ Ài>`}ÊÊ*ÞÌ ]Ê«°ÊÎä 60 New Products UÊÌÀ`ÕV}Ê-ÕLÕÌ>]Ê>Ê iÜÊ`ÊvÊ Õ`]Ê«°Ên 103 Advertisers Index UÊ1LÕÌÕÊ>`Ê >à Ê>ÃÊ>Ê7`ÜÃÊ*À}À>]Ê«°ÊÎn LINUX JOURNAL (ISSN 1075-3583) is published monthly by Belltown Media, Inc., PO Box 980985, Houston, TX 77098 USA. Subscription rate is $29.50/year. Subscriptions start with the next issue. 5 | October 2017 | http://www.linuxjournal.com LJ282-Oct2017.indd 5 9/19/17 3:40 PM Executive Editor Jill Franklin [email protected] Senior Editor Doc Searls [email protected] Associate Editor Shawn Powers [email protected] Art Director Garrick Antikajian [email protected] Products Editor James Gray [email protected] Editor Emeritus Don Marti [email protected] Technical Editor Michael Baxter [email protected] Senior Columnist Reuven Lerner [email protected] Security Editor Mick Bauer [email protected] Hack Editor Kyle Rankin lj@greenfly.net Virtual Editor Bill Childers [email protected] Contributing Editors )BRAHIM (ADDAD s 2OBERT ,OVE s :ACK "ROWN s $AVE 0HILLIPS s -ARCO &IORETTI s ,UDOVIC -ARCOTTE 0AUL "ARRY s 0AUL -C+ENNEY s $AVE 4AYLOR s $IRK %LMENDORF s *USTIN 2YAN s !DAM -ONSEN President Carlie Fairchild [email protected] Publisher Mark Irgang [email protected] Associate Publisher John Grogan [email protected] Director of Digital Experience Katherine Druckman [email protected] Accountant Candy Beauchamp [email protected] Linux Journal is published by, and is a registered trade name of, Belltown Media, Inc. 0/ "OX (OUSTON 48 53! Editorial Advisory Panel Nick Baronian Kalyana Krishna Chadalavada "RIAN #ONNER s +EIR $AVIS -ICHAEL %AGER s 6ICTOR 'REGORIO $AVID ! ,ANE s 3TEVE -ARQUEZ $AVE -C!LLISTER s 4HOMAS 1UINLAN #HRIS $ 3TARK s 0ATRICK 3WARTZ Advertising % -!),: [email protected] 52,: www.linuxjournal.com/advertising 0(/.% EXT Subscriptions % -!),: [email protected] 52,: www.linuxjournal.com/subscribe -!), 0/ "OX (OUSTON 48 53! LINUX IS A REGISTERED TRADEMARK OF ,INUS 4ORVALDS LJ282-Oct2017.indd 6 9/19/17 3:40 PM Manage data expansion You with SUSE Enterprise cannot Storage. SUSE Enterprise Storage, the leading open source storage solution, is highly keep up scalable and resilient, enabling high-end functionality at a fraction of with data the cost. explosion. suse.com/storage Data LJ282-Oct2017.indd 7 9/19/17 3:40 PM Current_Issue.tar.gz Bash and Cats F SOMEONE ASKED ME HOW THE INTERNET STAYS running, I’d probably say something like, I “Bash scripts and cat photos.” Because really, SHAWN those two things pretty much encompass the human POWERS ONLINE EXPERIENCE "ASH SCRIPTS ARE QUICK SNIPPETS OF TIMING SAVING CODE AND CAT PHOTOS ARE WELL PHOTOS Shawn Powers is the Associate Editor for OF FLUFFY KITTIES -OST DAYS THATS ENOUGH !LTHOUGH Linux Journal. He’s I won’t say this issue is based on that premise, I’d also the Gadget Guy like to pretend that’s the case! for LinuxJournal.com, and he has an 2EUVEN - ,ERNER STARTS THINGS OFF WITH HOW interesting collection to create multithreaded applications in Python. of vintage Garfield 3EE 4HREADYARN 4HE WHOLE WORLD IS CATS 5SUALLY coffee mugs. Don’t let his silly hairdo THE TASKS WE NEED COMPUTERS TO PERFORM ARE SO fool you, he’s a simple, the computer can do them one at a time pretty ordinary guy FASTER THAN WE CAN BLINK "UT WHAT IF THOSE TASKS and can be reached via email at ARE TIME CONSUMING -ULTITHREADING IS A GREAT WAY [email protected]. TO FORCE COMPUTERS TO DO MORE WORK AT ONCE Or, swing by the $AVE 4AYLOR FOLLOWS WITH AN ARTICLE ON "ASH #linuxjournal IRC channel on scripting inside Windows. Yes, even in Windows Freenode.net. "ASH SCRIPTS RULE ) THINK MY THEORY IS PROVING ITSELF Kyle Rankin talks about taking a vacation again THIS MONTH 3PECIFICALLY HE TALKS ABOUT PURCHASING A V cheap laptop that can be taken on vacation or used when on call without concern about it getting stolen OR DAMAGED 3URE MOST TECH FOLKS SPEND A FEW VIDEO: Shawn minutes on vacation solving a work issue, but why Powers runs TOTE YOUR FANCY EVERYDAY COMPUTER ALONG WITH YOU through WHEN A FLIMSY KEYBOARD AND OUTDATED #05 WILL WORK the latest issue. PERFECTLY FINE FOR FIVE MINUTES OF WORK )N FACT IF YOU READ MY ARTICLE THIS MONTH ON 8 | October 2017 | http://www.linuxjournal.com LJ282-Oct2017.indd 8 9/19/17 3:40 PM Current_Issue.tar.gz !NSIBLE PLAYBOOKS YOU MIGHT NEED LESS THAN FIVE MINUTES TO SOLVE problems back home. Ansible automation really starts to shine when playbooks are added to the mix. *IM (ALL TAKES MY CAT THEORY TO A VERY LITERAL DEGREE 4HIS MONTH HE SHOWS HOW TO CREATE YOUR OWN #!04#(! SYSTEM BUT RATHER THAN PROVING HUMAN NESS YOUR #!04#(! CAN TEST PERSONAL INFORMATION )N *IMS CASE HIS #!04#(! DISPLAYS A BUNCH OF CAT PHOTOS AND YOU NEED TO PICK WHICH CAT IS HIS &OR FRIENDS ITS A SIMPLE TEST &OR STRANGERS Not so much. Might it be tempting to answer incorrectly in order to SEE MORE CATS 9ES "UT THATS ONE OF THE DANGERS OF USING CATS 4HEIR FLUFFINESS IS HARD TO RESIST !NDY #ARLSON FINISHES OFF THE ISSUE WITH AN INDEPTH LOOK AT "ASH ITSELF 7E ALL KNOW A HANDFUL OF TRICKS "ASH CAN DO EASILY BUT WHAT ABOUT THINGS LIKE ENCRYPTION /UR EVER VIGILANT SCRIPTING LANGUAGE IS SO VERSATILE EVEN SEASONED PROFESSIONALS LIKE MYSELF ARE LIKELY TO FIND USEFUL TIPS AND TRICKS WE NEVER REALIZED WERE POSSIBLE 3PEAKING OF TIPS AND TRICKS THIS ISSUE OF Linux Journal MIGHT FOCUS ON FLUFF AND SCRIPTING BUT ITS ALSO FULL OF THE SAME TECH TIPS AND USEFUL programs you’ve come to expect every month. We also have new product announcements, updates about the tech world, and insight ON TECHNOLOGY IN GENERAL 4HIS WAS A FUN ISSUE OF Linux Journal, and IT CONTAINS FAR MORE CAT PHOTOS THAN MOST !LTHOUGH THAT MIGHT BE A SHORTCOMING OF THE OTHER ISSUES AS A CERTAIN NUMBER OF CAT PHOTOS should be considered baseline, no?Q RETURN TO CONTENTS 9 | October 2017 | http://www.linuxjournal.com LJ282-Oct2017.indd 9 9/19/17 3:40 PM UPFRONT UPFRONT NEWS + FUN PREVIOUS NEXT V V Current_Issue.tar.gz Editors’ Choice diff -u 7 >̽ÃÊ iÜÊÊÊ iÀiÊ iÛi«iÌ 4HE OOM OUT OF MEMORY KILLER TARGETS PROCESSES THAT SEEM TO BE RESPONSIBLE FOR ZOTZING A SYSTEM DUE TO TAKING TOO MUCH 2!- )T RELIES on various policies to make a best guess about which process to kill, and then it kills it, on the hope that the system will then be usable again.
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages105 Page
-
File Size-