If you have two lists that have the same content in a different order (1, 2, 3, vs 3, 2, 1) are they they the same or different? Python considers them to be different. In some cases order may not matter to you, and you just want to know if the same items exist in… Continue reading Comparing Lists in Python
Category: Scripting
Shell scripting: Iterate over a list line-by-line instead of word-by-word
Let’s say a directory contains these files: My First File.txtMy Second File.txt If you wanted to take an action on each distinct file, you might try something like this: for file in `ls ~`; do echo $file; done The output will look like below, because the spaces and line breaks are both treated delineators of… Continue reading Shell scripting: Iterate over a list line-by-line instead of word-by-word
Munki nopkg to turn Bluetooth on and off
I’ve posted a Munki nopkg installer to control Bluetooth. Assigning it for install causes Bluetooth to be (re)enabled whenever Munki runs. Uninstallation turns Bluetooth off. https://github.com/davidmnelson/munki-nopkg/blob/master/BluetoothEnabled.plist
Automatically Update WordPress, Themes, and Plugins using WP-CLI
WordPress is a hugely popular blog/CMS platform, but with widespread adoption comes risk: It is a common target for hackers, exploits, etc. Accordingly, you should make sure it gets regular updates. WordPress has a built-in update mechanism but this also requires that its PHP files be writable by the web server, introducing a new set… Continue reading Automatically Update WordPress, Themes, and Plugins using WP-CLI