tag:blogger.com,1999:blog-53288079846331404492024-03-04T22:22:41.720-08:00Bashed Up BitsSystems, tools, and observations.A.K.http://www.blogger.com/profile/05667639074146674799noreply@blogger.comBlogger38125tag:blogger.com,1999:blog-5328807984633140449.post-24794275037630515202018-09-03T14:19:00.002-07:002020-05-08T09:24:14.161-07:00How do I dual-boot Ubuntu 18.04 on a 2011 Mac Mini?<h2 style="height: 0px;">
Machine Specs:</h2>
<div>
<br /></div>
<div>
<br /></div>
<div>
<ul>
<li>Mac Mini (Mid 2011), Macmini5,2</li>
<li>Core i7</li>
<li>16 GB RAM (2x8 GB)</li>
<li>AMD Radeon HD 6630M 256MB</li>
<li>27-inch Apple Thunderbolt Display</li>
<li>512 GB SSD</li>
<li>Running macOS 10.13 High Sierra</li>
</ul>
<h3>
</h3>
<h2>
Caution:</h2>
<br />
This process can result in data loss. If you have personal data on the Mac Mini before starting, back it up first. Twice! (One is none. Two is one. ~ U.S. Navy Seal saying). Also, mistyping in the parts of this process may brick your Mac Mini. You have been warned. If in doubt, stop working and do research on Google until you understand what's going on in the step. If you find an error, please leave a comment. I will update.<br />
<h3>
</h3>
<h2>
Note:</h2>
<br />
This is process I figured out in lieu of booting the Ubuntu install with EFI via refind. Via the refind boot method, I would constantly get:<br />
<br />
<span style="font-family: "courier new" , "courier" , monospace;">10:39:07 kernel: Couldn't get size: 0x800000000000000e<br />10:39:07 kernel: MODSIGN: Couldn't get UEFI db list<br />10:39:07 kernel: Couldn't get size: 0x800000000000000e</span><br />
<br />
The error seems to be related to Apple's use of Secure Boot.<br />
<br />
<h3>
</h3>
<h2>
</h2>
<h2>
Process:</h2>
<h3>
<ul></ul>
</h3>
</div>
<div>
<span id="docs-internal-guid-5ff06fa7-7fff-2b2c-3b89-893e6761dfd6"></span><br />
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span id="docs-internal-guid-5ff06fa7-7fff-2b2c-3b89-893e6761dfd6"><span style="font-family: "arial"; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">Before adding *any* personal data on the macOS side...</span></span></div>
<span id="docs-internal-guid-5ff06fa7-7fff-2b2c-3b89-893e6761dfd6">
</span>
<br />
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span id="docs-internal-guid-5ff06fa7-7fff-2b2c-3b89-893e6761dfd6"><span style="font-family: "arial"; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">Disk Utility -> Click on macOS drive (Let’s call it “<i>macOS</i>”) -> Click “<i>Partition</i>” button -> Click “<i>Partition</i>” button -> Click macOS partition on left -> Set size to half the drive. -> Click other half -> Make new parition using exFAT FS (FS type doesn’t matter). Click "<i>Apply</i>".</span></span></div>
<span id="docs-internal-guid-5ff06fa7-7fff-2b2c-3b89-893e6761dfd6">
</span>
<br />
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="font-family: "arial"; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;"><br /></span>
<span id="docs-internal-guid-5ff06fa7-7fff-2b2c-3b89-893e6761dfd6"><span style="font-family: "arial"; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">After resizing, connect a Apple native keyboard (dasKeyboard didn’t work).</span></span></div>
<span id="docs-internal-guid-5ff06fa7-7fff-2b2c-3b89-893e6761dfd6">
</span>
<br />
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="font-family: "arial"; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;"><br /></span>
<span id="docs-internal-guid-5ff06fa7-7fff-2b2c-3b89-893e6761dfd6"><span style="font-family: "arial"; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">Reboot pressing Command+R to go into recovery mode.</span></span></div>
<span id="docs-internal-guid-5ff06fa7-7fff-2b2c-3b89-893e6761dfd6">
</span>
<br />
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span id="docs-internal-guid-5ff06fa7-7fff-2b2c-3b89-893e6761dfd6"><span style="font-family: "arial"; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">Open Utilities -> Terminal </span></span></div>
<span id="docs-internal-guid-5ff06fa7-7fff-2b2c-3b89-893e6761dfd6">
</span>
<br />
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span id="docs-internal-guid-5ff06fa7-7fff-2b2c-3b89-893e6761dfd6"><span style="font-family: "arial"; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">Run: </span><span style="font-size: 11pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;"><span style="font-family: "courier new" , "courier" , monospace;">csrutil disable</span></span></span></div>
<span id="docs-internal-guid-5ff06fa7-7fff-2b2c-3b89-893e6761dfd6">
</span>
<br />
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span id="docs-internal-guid-5ff06fa7-7fff-2b2c-3b89-893e6761dfd6"><span style="font-family: "arial"; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">Reboot back into macOS.</span></span></div>
<span id="docs-internal-guid-5ff06fa7-7fff-2b2c-3b89-893e6761dfd6">
</span>
<br />
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span id="docs-internal-guid-5ff06fa7-7fff-2b2c-3b89-893e6761dfd6"><span style="font-family: "arial"; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">Download latest refind: </span><a href="https://www.rodsbooks.com/refind/index.html" style="text-decoration-line: none;"><span style="color: #1155cc; font-family: "arial"; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">https://www.rodsbooks.com/refind/index.html</span></a><span style="font-family: "arial"; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">, </span><a href="https://sourceforge.net/projects/refind/" style="text-decoration-line: none;"><span style="color: #1155cc; font-family: "arial"; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">https://sourceforge.net/projects/refind/</span></a></span></div>
<span id="docs-internal-guid-5ff06fa7-7fff-2b2c-3b89-893e6761dfd6">
</span>
<br />
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span id="docs-internal-guid-5ff06fa7-7fff-2b2c-3b89-893e6761dfd6"><span style="font-family: "arial"; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">For the purposes of this doc, your username is “username”. Change as needed.</span></span></div>
<span id="docs-internal-guid-5ff06fa7-7fff-2b2c-3b89-893e6761dfd6">
</span>
<br />
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span id="docs-internal-guid-5ff06fa7-7fff-2b2c-3b89-893e6761dfd6"><span style="font-family: "arial"; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">Unpack into ~/Downloads/refind-some_version_number</span></span></div>
<span id="docs-internal-guid-5ff06fa7-7fff-2b2c-3b89-893e6761dfd6">
</span>
<br />
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span id="docs-internal-guid-5ff06fa7-7fff-2b2c-3b89-893e6761dfd6"><span style="font-family: "arial"; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">Reboot into recovery mode by holding down Command-R.</span></span></div>
<span id="docs-internal-guid-5ff06fa7-7fff-2b2c-3b89-893e6761dfd6">
</span>
<br />
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span id="docs-internal-guid-5ff06fa7-7fff-2b2c-3b89-893e6761dfd6"><span style="font-family: "arial"; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">Open Utilities -> Terminal</span></span></div>
<span id="docs-internal-guid-5ff06fa7-7fff-2b2c-3b89-893e6761dfd6">
</span>
<br />
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span id="docs-internal-guid-5ff06fa7-7fff-2b2c-3b89-893e6761dfd6"><span style="font-family: "arial"; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">Run: cd /Volumes/macOS/Users/username/Downloads/refind-some_version_number</span></span></div>
<span id="docs-internal-guid-5ff06fa7-7fff-2b2c-3b89-893e6761dfd6">
</span>
<br />
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span id="docs-internal-guid-5ff06fa7-7fff-2b2c-3b89-893e6761dfd6"><span style="font-family: "arial"; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">Run: </span><span style="font-size: 11pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;"><span style="font-family: "courier new" , "courier" , monospace;">cp refind-install refind-install.save</span></span></span></div>
<span id="docs-internal-guid-5ff06fa7-7fff-2b2c-3b89-893e6761dfd6">
</span>
<br />
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span id="docs-internal-guid-5ff06fa7-7fff-2b2c-3b89-893e6761dfd6"><span style="font-family: "arial"; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">Run: </span><span style="font-size: 11pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;"><span style="font-family: "courier new" , "courier" , monospace;">vi refind-install</span></span></span></div>
<span id="docs-internal-guid-5ff06fa7-7fff-2b2c-3b89-893e6761dfd6">
</span>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span id="docs-internal-guid-5ff06fa7-7fff-2b2c-3b89-893e6761dfd6"><span style="font-family: "arial"; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">Change: </span><span style="font-size: 11pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;"><span style="font-family: "courier new" , "courier" , monospace;">#!/usr/bin/env bash</span></span><span style="font-family: "arial"; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;"> TO </span><span style="font-size: 11pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;"><span style="font-family: "courier new" , "courier" , monospace;">#!/bin/bash</span></span></span></div>
<span id="docs-internal-guid-5ff06fa7-7fff-2b2c-3b89-893e6761dfd6">
</span>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span id="docs-internal-guid-5ff06fa7-7fff-2b2c-3b89-893e6761dfd6"><span style="font-family: "arial"; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">(The rescue env doesn’t seem to have </span><span style="font-size: 11pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;"><span style="font-family: "courier new" , "courier" , monospace;">/usr/bin/env</span></span><span style="font-family: "arial"; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">)</span></span></div>
<span id="docs-internal-guid-5ff06fa7-7fff-2b2c-3b89-893e6761dfd6">
<br /><div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="font-family: "arial"; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">Run: </span><span style="font-size: 11pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;"><span style="font-family: "courier new" , "courier" , monospace;">./refind-install</span></span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="font-family: "arial"; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">(no arguments are needed on macOS. Some may actually break macOS!!!)</span></div>
<br /><div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="font-family: "arial"; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">Reboot.</span></div>
<br /><div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="font-family: "arial"; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">On refind screen choose: "<i>Boot from disk macOS</i>".</span></div>
<br /><div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="font-family: "arial"; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">In macOS, download Ubuntu 18.04 desktop ISO and “<i>Etcher</i>” app for macOS.</span></div>
<br /><div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="font-family: "arial"; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">Insert USB stick (at least 16 GB?).</span></div>
<br /><div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="font-family: "arial"; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">Use Etcher to write the Ubuntu ISO to the USB stick.</span></div>
<br /><div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="font-family: "arial"; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">Open Terminal.</span></div>
<br /><div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="font-family: "arial"; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">Run: </span><span style="font-size: 11pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;"><span style="font-family: "courier new" , "courier" , monospace;">sudo su - </span></span></div>
<br /><div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="font-family: "arial"; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">Run: </span><span style="font-size: 11pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;"><span style="font-family: "courier new" , "courier" , monospace;">diskutil list</span></span></div>
<br /><div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="font-family: "arial"; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">Look for disk with size of USB stick (e.g. 16GB).</span></div>
<br /><div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="font-family: "arial"; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">Run: </span><span style="font-size: 11pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;"><span style="font-family: "courier new" , "courier" , monospace;">bless -device /dev/diskX -legacy -setBoot -nextonly </span></span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="font-family: "arial"; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">(Bless the whole disk, not the partition)</span></div>
<br /><div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="font-family: "arial"; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">With USB stick plugged in, reboot.</span></div>
<br /><div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="font-family: "arial"; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">You should be able to boot into Ubuntu setup without EFI issues (“legacy”).</span></div>
<br /><div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="font-family: "arial"; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">At the Welcome screen, choose your language and click “<i>Install Ubuntu</i>”.</span></div>
<br /><div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="font-family: "arial"; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">Choose your keyboard layout and click “<i>Continue</i>”.</span></div>
<br /><div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="font-family: "arial"; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">Click “<i>Normal Installation</i>” and check the “<i>Install third party software…</i>” box. Then click “<i>Continue</i>”.</span></div>
<br /><div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="font-family: "arial"; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">---</span></div>
<br /><div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="font-family: "arial"; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;"><b><i>!!!! VERY IMPORTANT !!!!</i></b></span></div>
<br /><div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="font-family: "arial"; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;"><b>ON THE “Installation Type” screen CLICK “Something else”</b></span></div>
<br /><div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="font-family: "arial"; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">Then click “<i>Continue</i>”.</span></div>
<br /><div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="font-family: "arial"; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">You will see TWO partitions about 256GB in size. THE FIRST partition is your macOS partition!!!!</span></div>
<br /><div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="font-family: "arial"; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">Click the SECOND 256 GB partition with the EXFAT FILESYSTEM.</span></div>
<br /><div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="font-family: "arial"; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">Click the “<i>Change</i>” button.</span></div>
<br /><div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="font-family: "arial"; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">Under “<i>Use as</i>”, select one of the top six options (maybe not </span><span style="font-size: 11pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;"><span style="font-family: "courier new" , "courier" , monospace;">btrfs</span></span><span style="font-family: "arial"; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">? I don't know the status of using btrfs on your root filesystem.). I chose </span><span style="font-size: 11pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;"><span style="font-family: "courier new" , "courier" , monospace;">ext4</span></span><span style="font-family: "arial"; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">.</span></div>
<br /><div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="font-family: "arial"; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">Under “<i>Mount point</i>”, select “</span><span style="font-family: "courier new" , "courier" , monospace; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">/</span><span style="font-family: "arial"; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">”, click “<i>OK</i>”.</span></div>
<br /><div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="font-family: "arial"; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">---</span></div>
<br /><div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="font-family: "arial"; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;"><b><i>!!!! ALSO VERY IMPORTANT !!!!</i></b></span></div>
<br /><div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="font-size: 11pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;"><b><span style="font-family: "arial";">Under “Device for boot loader installation”, SELECT THE Linux PARTITION FROM THE PREVIOUS STEP (</span><span style="font-family: "courier new" , "courier" , monospace;">ext2,3,4/btrfs/jfs/xfs</span><span style="font-family: "arial";">)! NOT the macOS partition! NOT the whole drive.</span></b></span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="font-size: 11pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;"><b><span style="font-family: "arial";">(probably </span><span style="font-family: "courier new" , "courier" , monospace;">/dev/sda3</span><span style="font-family: "arial";">)</span></b></span></div>
<br /><div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="font-family: "arial"; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">Click “<i>Install Now</i>”.</span></div>
<br /><div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="font-family: "arial"; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">Follow rest of installation…</span></div>
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<br />
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="font-family: "arial"; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">Reboot Linux as instructed and remove install USB stick. P</span><span style="font-family: "arial"; font-size: 11pt; white-space: pre-wrap;">ress Command+R to go into recovery mode.</span></div>
<span style="font-family: "arial"; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;"><br style="font-family: Times; font-size: medium; white-space: normal;" /></span>
<br />
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="font-family: "arial"; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">Open Utilities -> Terminal </span></div>
<span style="font-family: "arial"; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;"><br style="font-family: Times; font-size: medium; white-space: normal;" /></span>
<br />
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="font-family: "arial"; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">Run: </span><span style="font-size: 11pt; font-variant-east-asian: normal; font-variant-numeric: normal; vertical-align: baseline; white-space: pre-wrap;"><span style="font-family: "courier new" , "courier" , monospace;">csrutil enable</span></span></div>
<span style="font-family: "arial"; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;"><br style="font-family: Times; font-size: medium; white-space: normal;" /></span>
<br />
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="font-family: "arial"; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">Reboot.</span></div>
</div>
<div>
<br /></div>
On the refind screen:</span></div>
<div>
<br />
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="font-family: "arial"; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">To use Ubuntu 18.04, choose “Boot Linux (Legacy) from ext4 volume” on the right. It should have a penguin icon.</span></div>
<div>
<br /></div>
<div>
To use macOS, choose "<span style="font-family: "arial"; font-size: 14.6667px; white-space: pre-wrap;">Boot from disk macOS".</span></div>
<br />
<div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="font-family: "arial"; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;">That’s it.</span></div>
<div>
<span style="font-family: "arial"; font-size: 11pt; vertical-align: baseline; white-space: pre-wrap;"><br /></span></div>
</div>
<div class="blogger-post-footer">© 2013 Adam Keck</div>A.K.http://www.blogger.com/profile/05667639074146674799noreply@blogger.com0tag:blogger.com,1999:blog-5328807984633140449.post-22230187713611839792014-04-13T15:06:00.004-07:002014-04-15T13:43:34.432-07:00Two Trends Worth Mentioning...I usually shy away from predictions, but I think two new trends I am seeing more of recently are worth mentioning: <b>post-materialism culture</b> and <b>self-navigating quadro/multi-copters</b>.<br />
<br />
<h2>
Post-materialism</h2>
<br />
Since about three or four years ago, I've been seeing a slowly strengthening trickle of articles and personal stories on topics like the "tyranny of stuff" and "paying for experiences instead of things". The first well constructed expression of this trend I read was Bruce Sterling's "Last Viridian Note". While such a change in lifestyle in the past was driven by more external reasoning like "save the earth", this discourse has a more personal flavor to it. Up until the Great Recession (and a little after), there was in the U.S.A., and certain other emerging and developed economies, a relentless cultural drive to have luxurious things and, often, more than one of a particular luxurious thing. Doing so signaled high status.<br />
<br />
Today, however, in some sub-cultures of the West, owning almost nothing but a few exceedingly high quality items and developing the complete freedom of time and wealth to have endless interesting experiences holds the highest status. This shift is fascinating, because with a little skill, one needs much less wealth to create such a life, vs. the cost of a life of accumulating and maintaining a large collection of possessions. In an era of stagnant real income, eliminating the ongoing costs of possessions is becoming ever more attractive. Experiences happen, often make us happier, and then leave our lives. Unless we suffer some injury or ailment, the costs of an experience stop when it stops. People are starting to notice the "time cost" of possessions. Everything you have must, at some point, be maintained or curated. We lose that time forever. Between the reduction in available real income and the time spent on curation, shifting to a life of interesting experiences that make us happier leaves us with both more money and more time.<br />
<br />
<h2>
Quadro/multi-copters</h2>
<br />
Much of the startup chatter today is about disrupting this or that. Usually, either the disruption is of mundane things, or the basic business math does not really hold up in the long run, or the disruption is entirely within our online lives ("We're going to bring 'social' to ordering fast food online"). Actual "in real life" disruption, like horse and buggy to automobile, does not come around too often because of the great costs involved in developing a new technology. Two such technologies are emerging and merging, quadro/multi-copters and self-navigation. I think they will change our daily experience of transportation before 2020. In my understanding, while multi-copters have more rotor units, the whole system is simpler to manage and easier to fix.<br />
<br />
Like some past deep shifts in technology, multi-copter technology started in universities and the toy industry. Toys have notoriously razor-thin profit margins, so getting the complex flight behavior, efficiency, and reliability of a multi-copter into a profitable toy-priced package bodes well for future scaling. Toy multi-copters have already been imbued with self-navigation and self-organization behaviors, driven by sharply falling costs of GPS technology, model-based design, and the ongoing concurrent trends of miniaturization and power reduction for computers. This means that a particularly difficult aspect of a new technology, the mathematical models running the technology, are already simple enough and mature enough to sell toys profitably.<br />
<br />
Consider a multi-copter harness around a single standard shipping container or around a locked together block of containers. This would enable air delivery of the products inside with much less airport infrastructure - especially if the flight is fully automated. Multi-copters need similarly small infrastructure to helicopters, but their software model driven multitude of direct-driven rotors can have much better recovery characteristics than helicopters in the case of single rotor unit failure. Then consider, with enough safety engineering, the equivalent of an automated aerial train system without the need for the dedication of large land tracts to airports. It would take less infrastructure to build out such a system than an equivalent rail system. Such an infrastructure is certainly a strong candidate for enabling people mobility in rural areas of the world with limited rail infrastructure, like Africa and Siberia.<div class="blogger-post-footer">© 2013 Adam Keck</div>A.K.http://www.blogger.com/profile/05667639074146674799noreply@blogger.com0tag:blogger.com,1999:blog-5328807984633140449.post-20979494286158368702014-02-01T10:39:00.000-08:002022-10-15T10:05:05.935-07:00Lean - A Primer<h1>
A Brief Primer on LEAN</h1>
<br />© 2014, Adam S. Keck<br /><br />
Based on:<br />
<ul>
<li><a href="http://www.amazon.com/gp/product/B0015DWJ8M/ref=as_li_ss_tl?ie=UTF8&camp=1789&creative=390957&creativeASIN=B0015DWJ8M&linkCode=as2&tag=baupbi06-20">Chasing The Rabbit</a><img alt="" border="0" height="1" src="https://ir-na.amazon-adsystem.com/e/ir?t=baupbi06-20&l=as2&o=1&a=B0015DWJ8M" style="border: none !important; margin: 0px !important;" width="1" /> by Steven Spear</li>
<li><a href="http://www.amazon.com/gp/product/B003FLMPRC/ref=as_li_ss_tl?ie=UTF8&camp=1789&creative=390957&creativeASIN=B003FLMPRC&linkCode=as2&tag=baupbi06-20">Toyota Production System: Beyond Large-Scale Production</a><img alt="" border="0" height="1" src="https://ir-na.amazon-adsystem.com/e/ir?t=baupbi06-20&l=as2&o=1&a=B003FLMPRC" style="border: none !important; margin: 0px !important;" width="1" /> by Taiichi Ohno</li>
<li><a href="http://www.amazon.com/gp/product/B003F7733W/ref=as_li_ss_tl?ie=UTF8&camp=1789&creative=390957&creativeASIN=B003F7733W&linkCode=as2&tag=baupbi06-20">Understanding A3 Thinking: A Critical Component of Toyota's PDCA Management System</a><img alt="" border="0" height="1" src="https://ir-na.amazon-adsystem.com/e/ir?t=baupbi06-20&l=as2&o=1&a=B003F7733W" style="border: none !important; margin: 0px !important;" width="1" /> by Durward K. Sobek II and Art Smalley</li>
</ul>
<br />
<br />
<br />
<br />
<h1>
Four Capabilities of Accelerating organizations</h1>
<ul>
<li>Specify precise approach to every task with built-in tests to detect failure and stop on error.</li>
<li>Swarm to solve problems – immediate RCA.</li>
<li>Share new knowledge throughout organization.</li>
<li>Leaders lead by developing above capabilities in every single employee.</li>
</ul>
<h1>
Work Flow and System Design</h1>
<ul>
<li>LEAN is a framework for successfully designing complex systems and work flows. A system is a collection of related work flows. A company can be viewed as a single complex system that provides value to customers in return for money.</li>
<li>LEAN is a way of working: Every employee uses LEAN work flow every day to both follow and improve the processes for which they are responsible.</li>
<li>LEAN is a specific implementation of Deming’s “Plan, Do, Check, Act” (<a href="http://en.wikipedia.org/wiki/PDCA">PDCA</a>)</li>
<li>Work flows should stop on error or self-regulate (“autonomation”): Each step has built in tests for verification.</li>
</ul>
<h3>
On failure, stop the process and trigger an immediate RCA (<a href="http://en.wikipedia.org/wiki/Autonomation">Autonomation</a>)</h3>
<ul>
<li>Start from the delivery of the correct work flow output to its consumer. Each downstream need paces and specifies work upstream in the process (<a href="http://en.wikipedia.org/wiki/Kanban">Kanban</a> is a specific method of achieving this goal).</li>
<li>Develop the work flow by working backward from the output that exactly fulfills the needs and requirements of final customer (i.e., what Raving Fans calls the <i>Ideal</i>).</li>
<li>Mistakes: Human error generally considered only when a person does not follow the current written process or does not verify that the output of each step is correct. All other errors are considered defects in the process that allow errors to occur. This philosophy drives the “Swarm to RCA each failure” capability.</li>
</ul>
<h3>
Work Flow Creation Framework (In order)</h3>
<ul>
<li>Specify outputs – What does the work flow have to deliver, to whom, when, and what does it mean for the work flow to be successful?</li>
<li>Design pathways – Flow of materials, information, and services. Who is specifically responsible for each step in a pathway?</li>
<li>Design step connections – Linkages between adjacent process steps</li>
<li>Specify task methods – How exactly is each step in each process accomplished successfully?</li>
</ul>
<h3>
Work Flow Creation Tools</h3>
<ul>
<li>Checklist</li>
<li>Automation code</li>
<li>Flow chart</li>
<li>Input/Output/Handoff chart</li>
</ul>
<h1>
Problem Solving (Iterate)</h1>
<h3>
Ideal</h3>
<ul>
<li>Defect-free work flow</li>
<li>On-demand work flow</li>
<li>Work flow provides only exact output needed by client process or customer.</li>
<li>Immediate fulfillment of needed output.</li>
<li>Work flow runs without waste</li>
<li>Work flow is safe and secure (personnel not harmed, and information and assets secure) </li>
</ul>
<h3>
General</h3>
<ul>
<li>The commonly cited “A3 process” is a specific work flow and presentation format that implements the elements below in a way that ensures customer buy-in at each step.</li>
<li>Use graphical elements to efficiently present and confirm information with customers.</li>
</ul>
<h3>
Elements</h3>
<ul>
<li>Background: Why is this problem important?</li>
<li>Current condition: Measurements and metrics. Get and confirm information directly.</li>
<li>Gap analysis: How do the process and its outputs differ from the ideal (see previous section)</li>
<li>Root Cause Analysis: Swarm on failure; analyze gaps from ideal</li>
<li>Develop Countermeasures (rapid prototyping = experiments to find right solutions.)</li>
<li>Specify target condition: Desired new process with countermeasures in place</li>
<li>Measure actual outcome of new process: repeat measurements and metrics</li>
<li>Gap analysis and further RCA</li>
</ul>
<h1>
Sharing Knowledge</h1>
<ul>
<li>Organization-wide sharing accelerates productivity. Everyone follows documented work flows. </li>
<li>See one, Show one, Do one (from hospital LEAN efforts).</li>
<li>Codify discoveries for wide dissemination (e.g. Toyota “Lesson learned books” specify what’s feasible/cost-effective for a certain type of output or process)</li>
<li>Knowledge-base that stores documented work flows = “company memory”</li>
</ul>
<h3>
Training</h3>
<ul>
<li>Regularly practice system design and problem solving</li>
<li>Develop LEAN skills in all employees, at every level.</li>
<li>Practice following work flows with verification of each step to prevent defects.</li>
</ul>
<h3>
Leading</h3>
<ul>
<li>Everyone works using LEAN principles every day. Bottom up – sometimes guided - work flow improvement.</li>
<li>Everyone who knows the skills above leads those who are new by teaching them the above skills.</li>
<li>Learn to see and solve problems with rapid prototype iterations. Practice this skill.</li>
<li>Work flow improvers get and confirm information directly. Nothing is assumed.</li>
</ul>
<div class="blogger-post-footer">© 2013 Adam Keck</div>A.K.http://www.blogger.com/profile/05667639074146674799noreply@blogger.com0tag:blogger.com,1999:blog-5328807984633140449.post-9277056339268845452013-11-18T18:02:00.000-08:002014-05-14T11:58:57.762-07:00How to play a video on a Raspberry Pi Desktop by double-clicking on a file...<h3>
The article describes how to open video, audio, and other media files in the Raspberry Pi desktop (the LXDE file manager) using the GPU-based player program.</h3>
<div>
<br /></div>
<div>
<br /></div>
<div>
<br /></div>
<div>
<br /></div>
<h3>
Does double-clicking on a video file in Raspbian result in slow blocky playback in SMPlayer and VLC on your Raspberry Pi?</h3>
<div>
The short answer is that those video players will not work because at this time (Nov. 2013), they do not make use of the GPU on the Raspberry Pi. You need to use the hardware accelerated player, omxplayer, that is used in XBMC Live and OpenELEC. The problem is that omxplayer is a command line player that is designed to be embedded in the XBMC based distributions. I present below a way to make it play videos, if you double-click them in the Raspbian Desktop. Others have presented this method, but I've added a little bit of abstraction to make management easier. To start, open LXTerminal and the follow the process below.</div>
<div>
<br /></div>
<h3>
Step One - Get rid of the CPU-based media players</h3>
<div>
<span style="font-family: Courier New, Courier, monospace;"><br /></span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;">sudo aptitude remove vlc smplayer</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><br /></span></div>
<div>
<br /></div>
<h3>
Step Two - Install omxplayer and xterm</h3>
<div>
<br /></div>
<div>
<span style="font-family: Courier New, Courier, monospace;">aptitude install omxplayer xterm</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><br /></span></div>
<div>
<br /></div>
<div>
<span style="font-family: inherit;">I'm installing xterm, because its command line syntax is clear. To have keyboard control when omxplayer is run, it must be run from an open terminal. I don't know why this is, but this is what works. Simply calling omxplayer as the application to open a media file works, but you lose keyboard control. This means, for example, that you can't quit omxplayer in the middle of a video.</span></div>
<div>
<span style="font-family: inherit;"><br /></span></div>
<div>
<br /></div>
<h3>
Step Three - Make a wrapper script with a simple name to start omxplayer in an xterm</h3>
<div>
<br /></div>
<div>
<span style="font-family: Courier New, Courier, monospace;">sudo nano /usr/local/bin/vplay</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><br /></span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><br /></span></div>
<div>
<span style="font-family: inherit;">Add the following contents to the file:</span></div>
<div>
<span style="font-family: inherit;"><br /></span></div>
<div>
<span style="font-family: inherit;"><br /></span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;">#!/bin/bash</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;">exec xterm -fullscreen -fg black -bg black -e omxplayer -o hdmi -r "$1"</span></div>
<div>
<br /></div>
<div>
<br /></div>
<div>
<span style="font-family: inherit;">The "-o hdmi" forces omxplayer to pipe audio through the HDMI cable. Leave this option out if you have your Pi configured to use the headphone jack.</span></div>
<div>
<br /></div>
<div>
<span style="font-family: inherit;">Save the file and quit, then make it executable:</span></div>
<div>
<span style="font-family: inherit;"><br /></span></div>
<div>
<span style="font-family: inherit;"><br /></span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;">sudo chmod 755 /usr/local/bin/vplay</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><br /></span></div>
<div>
<br /></div>
<h3>
<span style="font-family: inherit;">Step Four - Make the "vplay" script the default handler for each video file type</span></h3>
<div>
<span style="font-family: inherit;"><br /></span></div>
<div>
We will use "mp4" files as an example.</div>
<div>
<br /></div>
<div>
Find a video file with the "mp4" file extension. Right-click on it and select "Open with...". Click the "Custom Command Line" tab. Type "vplay %f" into the "Command line to execute:" box. Check the box at the bottom of the screen with the label "Set selected application as default action for this file type".</div>
<div>
<br /></div>
<div>
Click "OK"</div>
<div>
<br /></div>
<div>
If everything is correct, the file will now play in omxplayer. Press "q" to quit the program.</div>
<div>
<br /></div>
<div>
From this point forward, double-clicking any "mp4" file in the LXDE file manager will automatically play the file in omxplayer. Spacebar pauses. The arrow keys skip forward and back. "2" speeds up the playback. To stop the sped up playback, press the spacebar twice.</div>
<div>
<br /></div>
<div>
Repeat step four for any other file extensions you want to automatically play.</div>
<div>
<br /></div>
<div>
If you make a mistake in the last step, you can clean up your bad attempt by deleting the "user-*" files in ~/.local/share/applications/.</div>
<div>
<br /></div>
<div>
Using this wrapper script technique means that you can modify the omxplayer options at any time without have to make the changes for each file extension in the LXDE file manager. Just edit /usr/local/bin/vplay.<br />
<br />
Note that this script works for audio files as well. They will play with a black screen. It makes for a lightweight way to play audio files without opening an full application like Clementine.</div>
<div>
<br /></div>
<div>
Hope this helps!</div>
<div>
<br /></div>
<div>
-Adam</div>
<div class="blogger-post-footer">© 2013 Adam Keck</div>A.K.http://www.blogger.com/profile/05667639074146674799noreply@blogger.com0tag:blogger.com,1999:blog-5328807984633140449.post-47725254283512382062013-11-01T18:11:00.003-07:002017-11-06T21:27:38.089-08:00PowerShell One-Liners<br />
<h2>
Introduction</h2>
<div>
<br /></div>
<div>
<br /></div>
PowerShell is Microsoft's shell for their product lines. It's now on version 3.0. If you miss the power of the command line while using Windows on either your laptop or servers, PowerShell provides that power.<br />
<br />
<br />
<h2>
Important concepts:</h2>
<br />
<ul>
<li>Almost all aspects of the Microsoft ecosystem are objects within an overarching structure. You query and manipulate this structure and its objects with PowerShell. This includes all aspects of SharePoint, Active Directory, and Exchange. Other companies, like VMware (see below) have also written PowerShell modules.</li>
<li>This "object nature" means that PowerShell pipes pass objects and properties, not just text. </li>
<li>Variables store data-structures of objects. </li>
</ul>
<div>
<br /></div>
<h2>
</h2>
<h2>
One-liners</h2>
<div>
<br /></div>
<div>
<br /></div>
<i>Note: Unwrap the code lines before you use them.</i><br />
<br />
<div>
<h2>
</h2>
<h2>
</h2>
<h2>
Get Help</h2>
<div>
<br /></div>
<br />
<b>Get the usage of the command "Select-Object":</b><br />
<br />
<span style="font-family: "courier new" , "courier" , monospace;">Get-Help Select-Object</span><br />
<br />
<b>Built-in examples for the command "Select-Object":</b><br />
<br />
<span style="font-family: "courier new" , "courier" , monospace;">Get-Help Select-Object -examples | more</span><br />
<br />
<b>Get the list of all commands and sort it:</b><br />
<br />
<span style="font-family: "courier new" , "courier" , monospace;">Get-Command | select-object name | sort name | more</span><br />
<br />
<b>Get the list of help topics for other parts of PowerShell:</b><br />
<br />
<span style="font-family: "courier new" , "courier" , monospace;">Get-Help about*</span><br />
<br />
<h2>
Command History</h2>
<span style="font-family: "courier new" , "courier" , monospace;">history | select -Unique | Where-Object { $_ -like "*pattern*" }</span><br />
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span></div>
<h2>
Opening Files and Programs</h2>
<br />
<br />
<b>PowerShell equivalent to Apple's Mac OS X command "open" is "Invoke-Item":</b><br />
<b><br /></b>
<b>Start firefox.exe:</b><br />
<br />
<span style="font-family: "courier new" , "courier" , monospace;">Invoke-Item "C:\Program Files (x86)\Mozilla Firefox\firefox.exe"</span><br />
<br />
<b>Open the file "Document.pdf" that is located the current directory:</b><br />
<br />
<span style="font-family: "courier new" , "courier" , monospace;">Invoke-Item Document.pdf</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span>
<br />
<div>
<span style="font-family: "courier new" , "courier" , monospace;">Invoke-Item "\\myserver\c\Files\Document.pdf"</span><br />
<br /></div>
<h2>
</h2>
<h2>
Manage Processes</h2>
<div>
<br /></div>
<div>
<b>To pattern match on an object list, use "Where-Object". The current object being processed is referred to by the special variable "$_". Members are accessed via the "." operator.:</b></div>
<div>
<br />
<span style="font-family: "courier new" , "courier" , monospace;">Get-Process | Where-Object {$_.processname -match "powershell" } | Select-Object processname,CPU,VM</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span>
<b>Dump all properties for all processes, print the process name and the VM size, and then sort by VM size:</b><br />
<br />
<span style="font-family: "courier new" , "courier" , monospace;">Get-Process | Select-Object processname,virtualmemorysize | sort virtualmemorysize</span><br />
<br />
<b>Find the busiest Google Chrome process:</b><br />
<br />
<span style="font-family: "courier new" , "courier" , monospace;">Get-Process chrome* | Select-Object processname,ID,CPU | sort CPU</span><br />
<br />
<b>Store the list of process objects:</b><br />
<br />
<span style="font-family: "courier new" , "courier" , monospace;">$ListOfProcessObjects = Get-Process</span></div>
<div>
<br /></div>
<div>
<b>Print the process name and virtual memory size from the stored process objects and sort by virtual memory size:</b></div>
<div>
<br /></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">$ListOfProcessObjects | Select-Object processname,VM | sort VM</span></div>
<div>
<br /></div>
<div>
<b>Print the chrome processes and sort by virtual memory size:</b></div>
<div>
<br />
<span style="font-family: "courier new" , "courier" , monospace;">$ListOfProcessObjects | Where-Object { $_.processname -match "chrome" } | select-object processname,VM | sort VM</span><br />
<br />
<b>Find the Google Chrome process with the largest VM size:</b><br />
<br />
<span style="font-family: "courier new" , "courier" , monospace;">Get-Process chrome* | sort VM | Select-Object processname,ID,VM -last 1</span><br />
<br />
<b>Find the Google Chrome process with the smallest VM size:</b><br />
<br />
<span style="font-family: "courier new" , "courier" , monospace;">Get-Process chrome* | sort VM | Select-Object processname,ID,VM -first 1</span><br />
<br />
<b>Stop all Chrome processes:</b><br />
<br />
<span style="font-family: "courier new" , "courier" , monospace;">Stop-Process -processname chrome*</span></div>
<div>
<b><br /></b></div>
<div>
<h2>
</h2>
<h2>
Working on file systems</h2>
<div>
<br /></div>
<b>Find all "exe" files in a tree, list their full path, and sort "fullname":</b><br />
<br />
<span style="font-family: "courier new" , "courier" , monospace;">Get-ChildItem 'C:\Tree\Of\Files\' -recurse -include *.exe | select-object fullname | sort fullname | more</span><br />
<b><br /></b><b>Find all mp3s and sort by ascending size:</b><br />
<b><br /></b>
<span style="font-family: "courier new" , "courier" , monospace;">Get-ChildItem '</span><span style="font-family: "courier new" , "courier" , monospace;">C:\Tree\Of\Files\</span><span style="font-family: "courier new" , "courier" , monospace;">' -recurse -include *.mp3 | </span><span style="font-family: "courier new" , "courier" , monospace;">select-object fullname,length | sort length</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span>
<b>Find all mkvs and sort by ascending lastaccesstime:</b><br />
<div>
<b><br /></b></div>
<span style="font-family: "courier new" , "courier" , monospace;">Get-ChildItem '</span><span style="font-family: "courier new" , "courier" , monospace;">C:\Tree\Of\Files\</span><span style="font-family: "courier new" , "courier" , monospace;">' -recurse -include </span><span style="font-family: "courier new" , "courier" , monospace;">*.mkv | select-object fullname,lastaccesstime | sort lastaccesstime</span><br />
<br />
<b>To get a list of all of an objects properties, use Where-Object on the list of file system objects to get a single object, and then pipe the object to: Select-Object * | more</b><br />
<br />
<span style="font-family: "courier new" , "courier" , monospace;">Get-ChildItem '</span><span style="font-family: "courier new" , "courier" , monospace;">C:\Tree\Of\Files\</span><span style="font-family: "courier new" , "courier" , monospace;">' -recurse -include </span><span style="font-family: "courier new" , "courier" , monospace;">*.pdf </span><span style="font-family: "courier new" , "courier" , monospace;">| Where-Object { $_.fullname -match ".*Q1_Report.pdf<span id="goog_1825639102"></span>" } | Select-Object * | more</span><br />
<br />
<b>Get pdfs that were last accessed by Windows in 2008, get their fullname, length, and last access time, then finally sort by length in ascending order:</b><br />
<br />
<span style="font-family: "courier new" , "courier" , monospace;">Get-ChildItem '</span><span style="font-family: "courier new" , "courier" , monospace;">C:\Tree\Of\Files\</span><span style="font-family: "courier new" , "courier" , monospace;">' -recurse -include </span><span style="font-family: "courier new" , "courier" , monospace;">*.pdf </span><span style="font-family: "courier new" , "courier" , monospace;">| </span><span style="font-family: "courier new" , "courier" , monospace;">{$_.LastAccessTime -match "2008" } | Select-Object fullname,length,LastAccessTime | sort length</span><br />
<div>
<br />
<b>You can output a command to CSV with "Export-CSV". This command requires a filename as an argument:</b><br />
<b><br /></b></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">Get-ChildItem '</span><span style="font-family: "courier new" , "courier" , monospace;">C:\Tree\Of\Files\</span><span style="font-family: "courier new" , "courier" , monospace;">' -recurse -include </span><span style="font-family: "courier new" , "courier" , monospace;">*.pdf</span><span style="font-family: "courier new" , "courier" , monospace;"> | Select-Object fullname,lastaccesstime,length | sort length | Export-Csv C:\Files\list.csv</span><br />
<br />
<b>Load the above results into the clipboard as a list:</b><br />
<br />
<span style="font-family: "courier new" , "courier" , monospace;">Get-ChildItem '</span><span style="font-family: "courier new" , "courier" , monospace;">C:\Tree\Of\Files\</span><span style="font-family: "courier new" , "courier" , monospace;">' -recurse -include </span><span style="font-family: "courier new" , "courier" , monospace;">*.pdf</span><span style="font-family: "courier new" , "courier" , monospace;"> |</span><span style="font-family: "courier new" , "courier" , monospace;"> Select-Object fullname,lastaccesstime,length | sort length | Format-list | clip</span><br />
<br />
<b>New directory:</b><br />
<br />
<span style="font-family: "courier new" , "courier" , monospace;">New-Item c:\Files\Log_Data -type directory</span></div>
<div>
<b><br /></b></div>
<div>
<b>New directory on a server:</b></div>
<div>
<b><br /></b></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">New-Item \\myserver\c\Files\Log_Data -type directory</span><br />
<br />
<b>New empty file:</b></div>
<div>
<b><br /></b>
<span style="font-family: "courier new" , "courier" , monospace;">New-Item c:\Files\Log_Data\logoutput.txt -type file</span></div>
<div>
<br />
<b>Create a new file on a server:</b></div>
<div>
<br /></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">New-Item \\myserver\c\Files\logoutput.txt -type file</span></div>
<div>
<br /></div>
<div>
<b>Rename a file:</b><br />
<br />
<span style="font-family: "courier new" , "courier" , monospace;">Rename-Item c:\Files\Log_Data\logoutput.txt logoutput.new.txt</span><br />
<br />
<b>Rename a file on a server:</b></div>
<div>
<br /></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">Rename-Item \\myserver\c\Files\logoutput.txt logoutput.new.txt</span><br />
<br />
<b>Delete a file:</b></div>
<div>
<br />
<span style="font-family: "courier new" , "courier" , monospace;">Remove-Item C:\Files\Log_Files\logoutput.txt.new</span></div>
<div>
<br /></div>
<div>
<b>Delete a file on a server:</b></div>
<div>
<br /></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">Remove-Item \\myserver\c\Log_Files\logoutput.txt</span></div>
<div>
<br />
<b>Delete a directory:</b><br />
<br />
<span style="font-family: "courier new" , "courier" , monospace;">Remove-Item C:\Files\Log_Files</span><br />
<br />
<b>Delete a directory on a server:</b></div>
<div>
<br /></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">Remove-Item \\myserver\c\Log_Files</span><br />
<br />
<b>Write text to a file. This replaces the contents of the file:</b><br />
<br />
<span style="font-family: "courier new" , "courier" , monospace;">set-content c:\Files\Log_Files\logoutput.txt.new -value "Line 1" + "Line 2" + "Line 3" + ....</span></div>
<h2>
</h2>
<h2>
</h2>
<h2>
</h2>
<h2>
</h2>
<h2>
</h2>
<h2>
Log Processing</h2>
<br />
<b>Store list of log objects from the event log "System":</b><br />
<br />
<span style="font-family: "courier new" , "courier" , monospace;">$SystemLogs = Get-EventLog System</span><br />
<br />
<b>Get all the log entries of entrytype "Error" from the stored system logs and then sort by "Message"</b><br />
<br />
<span style="font-family: "courier new" , "courier" , monospace;">$SystemLogs</span><span style="font-family: "courier new" , "courier" , monospace;"> | Where-Object {$_.entrytype -match "error" } | select-object message,entrytype | sort message | more</span><br />
<br />
<b>Get all the log entries of entrytype "Error" from the stored system logs and then return a sort list of unique log messages:</b><br />
<br />
<span style="font-family: "courier new" , "courier" , monospace;">$SystemLogs</span><span style="font-family: "courier new" , "courier" , monospace;"> | Where-Object {$_.entrytype -match "error" } | select-object message| sort message | more | Get-Unique -asstring | more</span><br />
<div>
<br />
<b>Get list of logging providers:</b></div>
<div>
<br />
<span style="font-family: "courier new" , "courier" , monospace;">$ListOfProviders = get-winevent -listprovider *</span></div>
<div>
<b><br /></b></div>
<h2>
</h2>
<h2>
Looking at Hotfixes</h2>
</div>
<div>
<br />
<b>Get the IDs of all installed hotfixes and their install times and then sort by install time:</b></div>
<div>
<br />
<span style="font-family: "courier new" , "courier" , monospace;">Get-HotFix | select-object hotfixid,installedon | sort installedon | more</span><br />
<br />
<b>Get the hotfix list from a remote machine (replace someservername with the name of a server in your environment). The account from which you run this needs admin rights to that machine:</b><br />
<br />
<span style="font-family: "courier new" , "courier" , monospace;">Get-HotFix -computername someservername| Select-Object hotfixid,installedon | sort installedon | more</span></div>
<h3>
</h3>
<h2>
</h2>
<h2>
</h2>
<h2>
</h2>
<h2>
</h2>
<h2>
Using PowerShell on remote machines</h2>
<div>
<br />
<b>Start an interactive PowerShell session on the remote computer myserver:</b></div>
<div>
<br />
<span style="font-family: "courier new" , "courier" , monospace;">Enter-PsSession myserver</span><br />
<br />
<b>Stop an interactive PowerShell session:</b></div>
<div>
<b><br /></b><span style="font-family: "courier new" , "courier" , monospace;">Exit-PsSession</span><br />
<br />
<b>Run a command on a list of remote machines:</b><br />
<br />
<span style="font-family: "courier new" , "courier" , monospace;">Invoke-Command -computername myserver1, myserver2, myserver3 {get-Process}</span><br />
<br />
<b>Run a remote script on a list of remote machines:</b><br />
<br />
<span style="font-family: "courier new" , "courier" , monospace;">Invoke-Command -computername myserver1,myserver2,myserver3 -filepath \\scriptserver\c\scripts\script.psl</span><br />
<br />
<b>Operate interactively on a list of machines by setting up a "session" of open connections:</b><br />
<br />
<span style="font-family: "courier new" , "courier" , monospace;">$InteractiveSession = new-pssession -computername myserver1, myserver2, myserver3</span><br />
<br />
<b>Run a remote command on the new session. This runs it all the connections in the session:</b><br />
<br />
<span style="font-family: "courier new" , "courier" , monospace;">Invoke-Command -session $InteractiveSession {Get-Process} </span><br />
<br />
<b>Run the remote command on the session, but report only certain objects:</b><br />
<br />
<span style="font-family: "courier new" , "courier" , monospace;">invoke-command -session $InteractiveSession {Get-Process | select-object name,VM,CPU }</span><br />
<h3>
</h3>
<h2>
</h2>
<h2>
</h2>
<h2>
</h2>
<h2>
</h2>
<h2>
Groups and Users</h2>
<br />
<b>Get all of the user objects in "Data-Center-Team"</b><br />
<br />
<span style="font-family: "courier new" , "courier" , monospace;">Get-ADGroupMember -Identity “Data-Center-Team”</span><br />
<br />
<b>Suppose the group IT-Team contains the group "Data-Center-Team" and other teams. To list the groups in "IT-Team":</b><br />
<br />
<span style="font-family: "courier new" , "courier" , monospace;">Get-ADGroupMember -Identity “IT-Team”</span><br />
<br />
<b>To list the groups in "IT-Team" and all of those groups' members:</b></div>
<div>
<br /></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">Get-ADGroupMember -Identity “IT-Team” -Recursive</span><br />
<br />
<b>Add user "thomasd" to the Data-Center-Team group:</b><br />
<br />
<span style="font-family: "courier new" , "courier" , monospace;">Add-ADGroupMember -Identity “Data-Center-Team” -Members "thomasd"</span><br />
<br />
<b>Remove user "thomasd" from the "Data-Center-Team" group:</b><br />
<br />
<span style="font-family: "courier new" , "courier" , monospace;">Remove-ADGroupMember -Identity “Group-A” -Members "thomasd"</span><br />
<br />
<b>Add the members of "London-Office" group to the "IT-Group" group:</b><br />
<br />
<span style="font-family: "courier new" , "courier" , monospace;">Get-ADGroupMember -Identity “London-Office” -Recursive | Get-ADUser | ForEach-Object {Add-ADGroupMember -Identity “IT-Group” -Members $_}</span><br />
<br />
<b>Remove the members of the "London-Office" group from the "IT-Group" group:</b><br />
<br />
<span style="font-family: "courier new" , "courier" , monospace;">Get-ADGroupMember -Identity “London-Office” -Recursive | Get-ADUser | ForEach-Object {Add-Remove-ADGroupMember “IT-Group” -Members $_}</span><br />
<br />
<b>Get all of the user objects in groups beginning with "Development-":</b><br />
<br />
<span style="font-family: "courier new" , "courier" , monospace;">Get-ADGroup -LDAPFilter “(name=Development-*)” | Get-ADGroupMember | Get-ADUser</span><br />
<br />
<b>Get all of the users in groups beginning with "Development-" that are disabled:</b><br />
<br />
<span style="font-family: "courier new" , "courier" , monospace;">Get-ADGroup -LDAPFilter “(name=Development-*)” | Get-ADGroupMember | Get-ADUser | Where-Object {$_.Enabled -eq $False }</span><br />
<br />
<b>Find all of the users in groups beginning with "Development-" that are disabled and add them to the "Development-Disabled" group:</b><br />
<br />
<span style="font-family: "courier new" , "courier" , monospace;">Get-ADGroup -LDAPFilter “(name=Development-*)” | Get-ADGroupMember | Get-ADUser | Where-Object {$.Enabled -eq $False} | ForEach-Object { Add-ADGroupMember -Identity “Development-Disabled” -Members $_ -Confirm:$False }</span><br />
<br />
<b>Get all members of all groups with their enabled status and put them in a CSV file in C:\Files\ :</b><br />
<br />
<span style="font-family: "courier new" , "courier" , monospace;">Get-ADGroup -LDAPFilter “(name=Development-*)” | Get-ADGroupMember | Get-ADUser | Select-Object Enabled,SamAccountName | sort Enabled | Export-Csv C:\Files\Development-Group-Users.csv</span><br />
<h3>
</h3>
<h2>
</h2>
<h2>
</h2>
<h2>
</h2>
<h2>
</h2>
<h2>
Other</h2>
<br />
<b>Reset your network connections:</b><br />
<br />
<span style="font-family: "courier new" , "courier" , monospace;">"release", "renew", "flushdns" | %{ipconfig /$_}</span><br />
<b><br /></b>
<b>Get a list of the domain controllers in your domain:</b><br />
<br />
<span style="font-family: "courier new" , "courier" , monospace;">[System.DirectoryServices.ActiveDirectory.Domain]::GetCurrentDomain() | Select-Object DomainControllers</span><br />
<br />
<h2>
VMware PowerCLI</h2>
<br />
<h3>
Connecting/Disconnecting</h3>
<br />
<span style="font-family: "courier new" , "courier" , monospace;">Connect-VIServer -Server virtualcenter.example.com -User adminusername</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span>
<span style="font-family: "courier new" , "courier" , monospace;">Disconnect-VIServer -Server virtualcenter.example.com -User adminusername</span><br />
<br />
<h4>
There is a default connection when starting the PowerCLI tool, so for an admin account, run</h4>
<span style="font-family: "courier new" , "courier" , monospace;">Disconnect-VIServer -Server vc-20-ah -Force -Confirm:$false</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span>
<span style="font-family: "courier new" , "courier" , monospace;">Connect-VIServer -Server virtualcenter.example.com -User adminusername</span><br />
<br />
<h3>
List VMs</h3>
<h4>
By name pattern</h4>
<span style="font-family: "courier new" , "courier" , monospace;">get-folder Virtual_Center_VM_folder | Get-VM | Where-Object { $_.Name -like "VM-name-pattern-*"} | Format-Table -wrap -AutoSize</span><br />
<br />
<h4>
By CPU count</h4>
<span style="font-family: "courier new" , "courier" , monospace;">get-folder Virtual_Center_VM_folder | Get-VM | Where-Object {$_.NumCpu -gt "2"} | Format-Table -wrap -AutoSize</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span>
<span style="font-family: "courier new" , "courier" , monospace;">get-folder Virtual_Center_VM_folder | Get-VM | Where-Object {$_.NumCpu -lt "2"} | Format-Table -wrap -AutoSize</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span>
<span style="font-family: "courier new" , "courier" , monospace;">get-folder Virtual_Center_VM_folder | Get-VM | Where-Object {$_.NumCpu -eq "2"} | Format-Table -wrap -AutoSize</span><br />
<br />
<h4>
By Memory</h4>
<span style="font-family: "courier new" , "courier" , monospace;">get-folder Virtual_Center_VM_folder | Get-VM | Where-Object {$_.MemoryGB -gt "4"} | Format-Table -wrap -AutoSize</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span>
<span style="font-family: "courier new" , "courier" , monospace;">get-folder Virtual_Center_VM_folder | Get-VM | Where-Object {$_.MemoryGB -lt "4"} | Format-Table -wrap -AutoSize</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span>
<span style="font-family: "courier new" , "courier" , monospace;">get-folder Virtual_Center_VM_folder | Get-VM | Where-Object {$_.MemoryGB -eq "4"} | Format-Table -wrap -AutoSize</span><br />
<br />
<h4>
By Power State</h4>
<span style="font-family: "courier new" , "courier" , monospace;">get-folder VM-folder-name | Get-VM | Where-Object { $_.PowerState -eq "PoweredOn" }</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span>
<span style="font-family: "courier new" , "courier" , monospace;">get-folder </span><span style="font-family: "courier new" , "courier" , monospace;">VM-folder-name</span><span style="font-family: "courier new" , "courier" , monospace;"> | Get-VM | Where-Object { $_.PowerState -eq "PoweredOff" }</span><br />
<br />
<h3>
Start, Stop, Restart, Delete VMs</h3>
<b><i>Note!!! ALWAYS operate exclusively on VMs in a folder AND use the VM name filter! Otherwise, update your resume.</i></b><br />
<br />
<h4>
Stop VMs</h4>
<span style="font-family: "courier new" , "courier" , monospace;">get-folder Virtual_Center_VM_folder | Get-VM | Where-Object { $_.Name -like "VM-name-pattern-*"} | Stop-VM</span><br />
<br />
<br />
<div style="-webkit-text-stroke-width: 0px; color: black; font-family: Times; font-size: medium; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; margin: 0px; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;">
</div>
<br />
<ul style="-webkit-text-stroke-width: 0px; color: black; font-family: Times; font-size: medium; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;">
<li>"A" to stop all matches at once</li>
<li>"Y" to stop VMs one at a time</li>
</ul>
<h4>
Restart VMs</h4>
<span style="font-family: "courier new" , "courier" , monospace;">get-folder Virtual_Center_VM_folder | Get-VM | Where-Object { $_.Name -like "VM-name-pattern-*"} | Restart-VM</span><br />
<h4>
Start VMs</h4>
<span style="font-family: "courier new" , "courier" , monospace;">get-folder Virtual_Center_VM_folder | Get-VM | Where-Object { $_.Name -like "VM-name-pattern-*"} | Start-VM</span><br />
<br />
<h4>
Delete VMs: Stop and Remove VMs from disk (see above note about your resume)</h4>
<span style="font-family: "courier new" , "courier" , monospace;">get-folder Virtual_Center_VM_folder | Get-VM | Where-Object { $_.Name -like "VM-name-pattern-*"} | Stop-VM</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span>
<span style="font-family: "courier new" , "courier" , monospace;">get-folder Virtual_Center_VM_folder | Get-VM | Where-Object { $_.Name -like "VM-name-pattern-*"} | Remove-VM -deletepermanently</span><br />
<br />
<h3>
Moving a VM</h3>
<br />
<h4>
Get VM datastore</h4>
<span style="font-family: "courier new" , "courier" , monospace;">get-folder Virtual_Center_VM_folder | Get-VM | Where-Object { $_.Name -like "VM-name-pattern-*"} | Get-Datastore | Format-Table -wrap -AutoSize</span><br />
<br />
<h4>
Get VM datastores on servers matching a pattern</h4>
<span style="font-family: "courier new" , "courier" , monospace;">Get-VMHost | Where-Object { $_.Name -like "*VM-host-name-pattern-*"} | Get-Datastore | Format-Table -wrap -AutoSize</span><br />
<br />
<h4>
Get datastores matching pattern</h4>
<span style="font-family: "courier new" , "courier" , monospace;">Get-Datastore | Where-Object { $_.Name -like "naming*pattern*" } | Format-Table -wrap -AutoSize</span><br />
<br />
<h4>
Get hosts for datastores matching a pattern</h4>
<span style="font-family: "courier new" , "courier" , monospace;">Get-Datastore | Where-Object { $_.Name -like "naming*pattern*" } | Get-VMHost | Format-Table -wrap -AutoSize</span><br />
<br />
<h4>
Get hosts for VMs matching a pattern</h4>
<span style="font-family: "courier new" , "courier" , monospace;">get-folder Virtual_Center_VM_folder | Get-VM | Where-Object { $_.Name -like "VM-name-pattern-*"} | Get-VMHost | Format-Table -wrap -AutoSize</span><br />
<br />
<h4>
Move VM. Use current host for moving between local datastores.</h4>
<span style="font-family: "courier new" , "courier" , monospace;">get-folder Virtual_Center_VM_folder | Get-VM | Where-Object { $_.Name -like "VM-name-pattern-*"} | Move-VM -Destination target_vmware_hostname -Datastore Target_Datastore_Name</span><br />
<br />
<h3>
Snapshot VM</h3>
<br />
<h4>
Get collection of VMs to snapshot</h4>
<span style="font-family: "courier new" , "courier" , monospace;">$collection_of_VMs=get-folder Virtual_Center_VM_folder | Get-VM | Where-Object { $_.Name -like "VM-name-pattern-*"}</span><br />
<br />
<h4>
Get list of snapshots for VMs in $collection_of_VMs (all snapshots, specific snapshot)</h4>
<span style="font-family: "courier new" , "courier" , monospace;">foreach($VM in $collection_of_VMs) {Get-Snapshot -VM $vm | Format-Table -wrap -AutoSize }</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span>
<span style="font-family: "courier new" , "courier" , monospace;">foreach($VM in $collection_of_VMs) {Get-Snapshot -VM $vm -Name "Test Snapshot" | Format-Table -wrap -AutoSize }</span><br />
<br />
<h4>
Create new snapshot for VMs in $collection_of_VMs</h4>
<span style="font-family: "courier new" , "courier" , monospace;">foreach($VM in $collection_of_VMs) {New-Snapshot -VM $vm -Name "Test Snapshot" -Memory:$true | Format-Table -wrap -AutoSize }</span><br />
<br />
<h4>
Remove snapshot for VMs in $collection_of_VMs (w/ confirmation for each VM and w/o confirmation for each VM)</h4>
<span style="font-family: "courier new" , "courier" , monospace;">foreach($VM in $collection_of_VMs) {Get-Snapshot -VM $vm -Name "Test Snapshot" | Remove-Snapshot -Confirm:$true | Format-Table -wrap -AutoSize }</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span>
<span style="font-family: "courier new" , "courier" , monospace;">foreach($VM in $collection_of_VMs) {Get-Snapshot -VM $vm -Name "Test Snapshot" | Remove-Snapshot -Confirm:$false | Format-Table -wrap -AutoSize }</span><br />
<br />
<br />
-Adam (a0f29b982)</div>
</div>
<div class="blogger-post-footer">© 2013 Adam Keck</div>A.K.http://www.blogger.com/profile/05667639074146674799noreply@blogger.com0tag:blogger.com,1999:blog-5328807984633140449.post-27713851998663265292013-06-26T02:11:00.001-07:002013-06-26T02:18:26.433-07:00Programatically named variables in bash.Suppose you wanted to do the following in bash:<br />
<div>
<br />
<pre>
for label in a b c d e f
do
variable_${label}=${label}
done
</pre>
<br />
This has the intended result of setting a series of variables:
<pre>
variable_a
variable_b
variable_c
variable_d
variable_e
variable_f
</pre>
<br />
But if what if you want to dereference them programatically?
<pre>
for label in a b c d e f
do
echo ${variable_${label}}
done
</pre>
is not acceptable bash syntax.
<br />
But there is a way...
<br />
We can abuse <i>export</i> and <i>env</i>. We set them with:
<pre>
for label in a b c d e f
do
export variable_${label}=${label}
done
</pre>
We can then programmatically dereference the variables by searching for them in the output of <i>env</i> and using <i>awk</i> to get their value.
<pre>
for label in a b c d e f
do
echo "`env | grep variable_${label} | awk -F= '{print $2}'`"
done
</pre>
How's that for bash abuse?
</div><div class="blogger-post-footer">© 2013 Adam Keck</div>A.K.http://www.blogger.com/profile/05667639074146674799noreply@blogger.com0tag:blogger.com,1999:blog-5328807984633140449.post-77035906548789954742013-04-12T08:44:00.001-07:002019-08-30T13:35:50.753-07:00Fixing SSH connection problems in EGit in Eclipse<br />
<div style="background-color: white; border: 0px; clear: both; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; font-size: 14px; line-height: 18px; margin-bottom: 1em; padding: 0px; vertical-align: baseline; word-wrap: break-word;">
Note: I posted a version of this on Stack Overflow.</div>
<div style="background-color: white; border: 0px; clear: both; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; font-size: 14px; line-height: 18px; margin-bottom: 1em; padding: 0px; vertical-align: baseline; word-wrap: break-word;">
Errors can occur when there is an underlying SSH authentication issue, like having the wrong public key on the git remote server or if the git remote server changed its SSH host key.</div>
<div style="background-color: white; border: 0px; clear: both; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; font-size: 14px; line-height: 18px; margin-bottom: 1em; padding: 0px; vertical-align: baseline; word-wrap: break-word;">
Often the an SSH error will appear as: "<span style="background-color: #eeeeee; font-family: "consolas" , "menlo" , "monaco" , "lucida console" , "liberation mono" , "dejavu sans mono" , "bitstream vera sans mono" , "courier new" , monospace , serif;">Invalid remote: origin: Invalid remote: origin"</span></div>
<div style="background-color: white; border: 0px; clear: both; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; font-size: 14px; line-height: 18px; margin-bottom: 1em; padding: 0px; vertical-align: baseline; word-wrap: break-word;">
<br />
<div style="border: 0px; clear: both; margin-bottom: 1em; padding: 0px; vertical-align: baseline; word-wrap: break-word;">
Eclipse will use the .ssh directory you specify in Preferences -> General -> Network Connections -> SSH2 for its ssh configuration. Set it "{your default user directory}.ssh\" .</div>
<div style="border: 0px; clear: both; margin-bottom: 1em; padding: 0px; vertical-align: baseline; word-wrap: break-word;">
To fix things, first you need to determine which ssh client you are using for Git. This is stored in the GIT_SSH environmental variable. Right-click on "Computer" (Windows 7), then choose Properties -> Advanced System Settings -> Environment Variables.</div>
<div style="border: 0px; clear: both; margin-bottom: 1em; padding: 0px; vertical-align: baseline; word-wrap: break-word;">
If GIT_SSH contains a path to plink.exe, you are using the PuTTY stack.</div>
<ul style="border: 0px; list-style-image: initial; list-style-position: initial; margin: 0px 0px 1em 30px; padding: 0px; vertical-align: baseline;">
<li style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline; word-wrap: break-word;">To get your public key, open PuTTYgen.exe and then load your private key file (*.ppk). The listed public key should match the public key on the git remote server.</li>
<li style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline; word-wrap: break-word;">To get the new host key, open a new PuTTY.exe session, and then connect to git@{git repo host}.</li>
<li style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline; word-wrap: break-word;">Click OK and say yes to store the new key.</li>
<li style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline; word-wrap: break-word;">Once you get a login prompt, you can close the PuTTY window. The new key has been stored.</li>
<li style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline; word-wrap: break-word;">Restart Eclipse.</li>
</ul>
<div style="border: 0px; clear: both; margin-bottom: 1em; padding: 0px; vertical-align: baseline; word-wrap: break-word;">
If GIT_SSH contains a path to "ssh.exe" in your "Git for Windows" tree, you are using Git for Windows's OpenSSH.</div>
<ul style="border: 0px; list-style-image: initial; list-style-position: initial; margin: 0px 0px 1em 30px; padding: 0px; vertical-align: baseline;">
<li style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline; word-wrap: break-word;">Set %HOME% to your default user directory (as listed in Eclipse; see above).</li>
<li style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline; word-wrap: break-word;">Set %HOMEDRIVE% to the drive letter of your default user directory.</li>
<li style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline; word-wrap: break-word;">Set %HOMEPATH% to the path to your default user directory on %HOMEDRIVE%</li>
<li style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline; word-wrap: break-word;">To get your public key, open the file %HOMEDRIVE%%HOMEPATH%/.ssh/id_rsa.pub (or id_dsa.pub) in a text editor. The listed public key should match the public key on the git remote server.</li>
<li style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline; word-wrap: break-word;">To get the new host key, run: cmd.exe</li>
<li style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline; word-wrap: break-word;">Run Git Bash</li>
<li style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline; word-wrap: break-word;">Ctrl-C</li>
<li style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline; word-wrap: break-word;">At the bash prompt, run /c/path/to/git/for/windows/bin/ssh.exe git@{git remote host}.</li>
<li style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline; word-wrap: break-word;">Type yes to accept the new key.</li>
<li style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline; word-wrap: break-word;">Once you have a login prompt, type: ctrl-c</li>
<li style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline; word-wrap: break-word;">Close the cmd.exe window</li>
<li style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline; word-wrap: break-word;">Restart Eclipse.</li>
</ul>
<div style="border: 0px; clear: both; margin-bottom: 1em; padding: 0px; vertical-align: baseline; word-wrap: break-word;">
Finally, if you are still having trouble with your external ssh client, delete the GIT_SSH environmental variable and set the HOME environmental variable to your default user directory on Windows. Without the GIT_SSH variable, EGit will use its internal ssh client (java). It will use the .ssh directory you specified above as its SSH configuration directory.</div>
<div style="border: 0px; clear: both; margin-bottom: 1em; padding: 0px; vertical-align: baseline; word-wrap: break-word;">
Note: If you have Git for Windows, you can use its tools to create a SSH key pair your .ssh directory:</div>
<ul style="border: 0px; list-style-image: initial; list-style-position: initial; margin: 0px 0px 1em 30px; padding: 0px; vertical-align: baseline;">
<li style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline; word-wrap: break-word;">Set %HOME% to your default user directory (as listed in Eclipse).</li>
<li style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline; word-wrap: break-word;">Set %HOMEDRIVE% to the drive letter of your default user directory.</li>
<li style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline; word-wrap: break-word;">Set %HOMEPATH% to the path to your default user directory on %HOMEDRIVE%</li>
<li style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline; word-wrap: break-word;">Run Git Bash</li>
<li style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline; word-wrap: break-word;">Ctrl -C</li>
<li style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline; word-wrap: break-word;">Run: ssh-keygen.exe -t rsa -b 2048</li>
<li style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline; word-wrap: break-word;">Save to the default filenames</li>
<li style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline; word-wrap: break-word;">Choose a passphrase or save without one. If you save with a passphrase, Eclipse will prompt you for it each time you push or pull from your git remote server.</li>
<li style="background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline; word-wrap: break-word;">Close Git Bash</li>
</ul>
<div style="border: 0px; clear: both; margin-bottom: 1em; padding: 0px; vertical-align: baseline; word-wrap: break-word;">
You can also use the GUI in the SSH2 Preference pane in Eclipse to manage hosts and keys.</div>
</div>
<ul style="background-color: white; border: 0px; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; font-size: 14px; line-height: 18px; list-style-image: initial; list-style-position: initial; margin: 0px 0px 1em 30px; padding: 0px; vertical-align: baseline;">
</ul>
<div class="blogger-post-footer">© 2013 Adam Keck</div>A.K.http://www.blogger.com/profile/05667639074146674799noreply@blogger.com0tag:blogger.com,1999:blog-5328807984633140449.post-80769012909938046852012-11-30T13:51:00.003-08:002013-10-29T21:46:40.317-07:00Where does Kindle Reader for Mac OS X from the App Store store my books?<br /><h2>
Where does Kindle Reader for Mac OS X store my books?</h2>
<br />Here:<br /><br /><br /> <code>/Users/yourusername/Library/Containers/com.amazon.Kindle/Data/Library/Application Support/Kindle/My Kindle Content/</code><br /><br /><div class="blogger-post-footer">© 2013 Adam Keck</div>A.K.http://www.blogger.com/profile/05667639074146674799noreply@blogger.com0tag:blogger.com,1999:blog-5328807984633140449.post-51840675349228964302012-10-25T14:33:00.001-07:002012-10-27T11:00:42.263-07:00Straight to Voicemail, If Unknown - A simple free method for blocking scam calls and robocalls<br />
<h3>
Problem: How do I block scam calls and robo calls?</h3>
<h3>
Premise: </h3>
If the call is important, the caller will leave a voicemail.<br />
<br />
<h3>
Solution:</h3>
<br />
We put every number we know into our caller ID systems.<br />
<br />
If a number we do not recognize, or a number that blocks caller ID calls, we <b>always</b> let the call go to voicemail. Callers that really want or need to talk with us will leave a voicemail. If we are not interested, we delete the message.<br />
<br />
This process initially upset some of our parents, but we have not had to deal with a robo or scam call in some time, since the calling computers almost never leave a voicemail. Our parents are now used it and leave messages. Sometimes, we pick up as soon as they start talking. Our friends mostly communicate via Facebook, internet chat tools, and email these days, so they are used to asynchronous communication and don't mind leaving a message. The political parties and charities we support do leave messages. We call them back to donate or express our support.<br />
<br />
It's simple, effective, and free.<div class="blogger-post-footer">© 2013 Adam Keck</div>A.K.http://www.blogger.com/profile/05667639074146674799noreply@blogger.com0tag:blogger.com,1999:blog-5328807984633140449.post-62767044570908534222012-10-12T17:52:00.001-07:002012-10-12T17:55:38.925-07:00A script to split a file tree into separate trees - one per file extension present in the original tree<h2>Purpose</h2>
<p>Have you ever had a tree of files from which you only needed certain types of file? For example, I had an iTunes library with some Apple files from another iTunes account combined with a large number of MP3s. I wanted to pull out the tree of MP3s only. You can make such a tree by passing a combination of flags to rsync that make it do an exclusive include.</p>
<h2>How?</h2>
<p>Pass the following flags to rsync to make it do an exclusive include for files fitting a certain globbing pattern. Fill in for the variables of course, if you want to use this line alone.</p>
<p>In particular, this rsync line:</p>
<pre>
rsync -av --include '*/' --include "*.${extension}" --exclude '*' ${source_directory}/ ${top_directory_of_results}/${extension}/
</pre>
<h2>The script:</h2>
<p>
==========================================================
<br><br>
This tool reads a directory of files that have extensions and then copies each type of file to its own tree.
<br><br>
The location of each file in the subtree matches that file's location in the original tree.
<br><br>
Usage:<br><br>
<pre> ./split_by_file_extension.sh \
{-s source directory|--source-dir=source directory }\
{-t top directory of results|--top-directory-of-results=top directory of results}\
{-e comma,separated,list,of,extensions | --extensions=comma,separated,list,of,extensions}
</pre>
<br><br>
==========================================================
<br><br>
</p>
<pre>
#!/bin/bash
set -e
set -u
find_of_files="./find.of.files.$$"
usage () {
echo "=========================================================="
echo "This tool reads a directory of files that have extensions"
echo "and then copies each type of file to its own tree."
echo ""
echo "The location of each file in the subtree matches that"
echo "file's location in the original tree."
echo ""
echo "Usage: $0 {-s source directory|--source-dir=source directory} \ "
echo " {-t top directory of results|--top-directory-of-results=top directory of results} \ "
echo " {-e comma,separated,list,of,extensions | --extensions=comma,separated,list,of,extensions} "
echo "=========================================================="
}
are_these_the_same_path () {
original_directory="`pwd`"
cd "$1"
first_directory="`pwd`"
cd "${original_directory}"
cd "$2"
second_directory="`pwd`"
cd "${original_directory}"
if [ "${first_directory}" = "${second_directory}" ]
then
echo true
else
echo false
fi
}
if [ $# -eq 0 ]
then
usage
exit 1
fi
needed_number_of_arguments_set=0
while [ $# -gt 0 ]
do
case $1 in
-s|--source-dir=*)
if [ "$1" = "-s" ]
then
shift
source_directory="$1"
shift
else
source_directory="`echo $1| sed s,--source-dir=,,`"
shift
fi
echo "Source Directory: ${source_directory}"
if [ ! -d ${source_directory} ]
then
echo""
echo "source_directory is not a directory."
echo ""
usage
exit 1
fi
needed_number_of_arguments_set="`echo ${needed_number_of_arguments_set} + 1| bc`"
;;
-e|--extensions=*)
if [ "$1" = "-e" ]
then
shift
extensions="$1"
shift
else
extensions="`echo $1| sed s#--extensions=##`"
shift
fi
echo "Extensions: ${extensions}"
needed_number_of_arguments_set="`echo ${needed_number_of_arguments_set} + 1| bc`"
;;
-t|--top-directory-of-results=*)
if [ "$1" = "-t" ]
then
shift
top_directory_of_results="$1"
shift
else
top_directory_of_results="`echo $1| sed s,--top-directory-of-results=,,`"
shift
fi
echo "Target Directory: ${top_directory_of_results}"
if [ ! -d ${top_directory_of_results} ]
then
echo""
echo "top_directory_of_results is not a directory."
echo ""
usage
exit 1
fi
needed_number_of_arguments_set="`echo ${needed_number_of_arguments_set} + 1| bc`"
;;
-h|--help)
usage
exit 0
;;
*)
echo ""
echo "Unrecognized flag." 1>&2
usage
exit 1
;;
esac
done
if [ "${needed_number_of_arguments_set}" -ne "3" ]
then
echo""
echo "All of the options must be set." 1>&2
usage
exit 1
fi
are_source_directory_and_top_directory_of_results_the_same="`are_these_the_same_path ${source_directory} ${top_directory_of_results}`"
if [ "${are_source_directory_and_top_directory_of_results_the_same}" = true ]
then
echo ""
echo "source_directory and top_directory_of_results cannot be the same." 1>&2
echo ""
usage
exit 1
fi
#######################################
#
# Main Process.
#
# Do a find for files.
# Check for files with extensions provided.
# Get directory path for files with listed extensions.
# Make the path for that file on the extension directory in the target directory.
# Copy files from source tree to the specific path in the target tree with rsync.
#
#######################################
for extension in `echo "${extensions}" | sed s/,/\ /g`
do
if [ ! -d ${top_directory_of_results}/${extension} ]
then
mkdir ${top_directory_of_results}/${extension}
fi
done
for extension in `echo "${extensions}" | sed s/,/\ /g`
do
rsync -av --include '*/' --include "*.${extension}" --exclude '*' ${source_directory}/ ${top_directory_of_results}/${extension}/
done
</pre><div class="blogger-post-footer">© 2013 Adam Keck</div>A.K.http://www.blogger.com/profile/05667639074146674799noreply@blogger.com0tag:blogger.com,1999:blog-5328807984633140449.post-62603792108887927512012-06-14T14:57:00.000-07:002013-10-30T11:39:43.904-07:00How do I clean up old large files on Linux?Many people who have run Linux file servers and ftp servers have at some point wanted to free up some space. One good algorithm to do this efficiently is to remove old data starting with the largest files first. So how to generate such a list? One method is to use a "<b>find -exec du</b>" command:<div>
<br /></div>
<div>
<pre>
find /path/to/full/file/system -type f -mtime +10 -exec du -sk {} \; | sort -n > /var/tmp/list_of_files_older_than_10_days_sorted_by_size
</pre>
</div>
<div>
Once you have that list, you can selectively delete files from the bottom of it. Note that the list will likely be exponentially sorted. That is, the bottom 10% of the list will take up a huge chunk of the used storage space.
</div><div class="blogger-post-footer">© 2013 Adam Keck</div>A.K.http://www.blogger.com/profile/05667639074146674799noreply@blogger.com0tag:blogger.com,1999:blog-5328807984633140449.post-14290775388113990932012-06-05T08:49:00.000-07:002012-08-08T11:45:44.993-07:00How the find the Active Directory Domain Controllers listed in DNS on Linux...Assumptions:<br />
<br />
<ul>
<li>You have the "host" utility from BIND.</li>
<li>You can do a zone transfer from the local DNS server</li>
<li>Your Active Directory admins have properly configured DNS for Active Directory</li>
</ul>
<div>
If you have the above, use the following command:</div>
<div>
<br />
<pre>
host -t srv -l your.active.directory.dns.domain | grep _kerberos._tcp.*._sites.dc._msdcs.your.active.directory.dns.domain
</pre>
<br />
Replace your.active.directory.dns.domain with your actual AD DNS domain.
</div><div class="blogger-post-footer">© 2013 Adam Keck</div>A.K.http://www.blogger.com/profile/05667639074146674799noreply@blogger.com0tag:blogger.com,1999:blog-5328807984633140449.post-72680220997554769622012-06-04T07:37:00.004-07:002012-10-02T16:10:27.309-07:00On Linux, how do I set the PATH for non-interactive, non-login shells? e.g. for the case of rksh?Non-interactive, non-login, shells inherit the PATH from the ssh process, so we must set the PATH with ssh. Some shells, like Korn Shell (ksh, rksh, pksh), only parse user environment files in login shells, so there's no way to change the inherited environment in non-interactive, non-login shells.
<br />
<ul>
<li>To set the path globally, build a custom ssh with the needed default path.</li>
<li>To set the path for a particular user, first configure ssh to use custom environments by enabling "PermitUserEnvironment" in /etc/ssh/sshd_config: PermitUserEnvironment yes
</li>
<li>Restart sshd</li>
<li>Then set the path in that user's authorized_keys file or using ~/.ssh/environment.</li>
<li>Note that you need to set <i>all</i> of the important shell variables. The existence of ~/.ssh/environment seems to preclude the setting of default environmental variable values.</li>
<li>So, for example, given a location for binaries for rksh (restricted korn shell), /usr/restricted/bin, place the following in ~/.ssh/environment:</li>
</ul>
<pre>HOME=/home/username
LOGNAME=username
MAIL=/var/mail/username
PATH=/usr/restricted/bin
PWD=/home/username
SHELL=/bin/rksh
SHLVL=1
USER=username
</pre>
<br />
<li>Note: replace <i>username</i> with the login of the user. Then, optionally, lock down write access to ~/.ssh/environment:</li>
<ul>
<li>Set the classical permissions:</li>
<ul>
<li>chown root:root /home/username/.ssh/environment</li>
<li>chmod 644 /home/username/.ssh/environment</li>
</ul>
<li>Or, place file in an restricted SE Linux context and then configure an SE Linux ACL restricting access.</li>
<li>Or, set a Posix ACL on the file to limit access.</li>
</ul>
<div class="blogger-post-footer">© 2013 Adam Keck</div>A.K.http://www.blogger.com/profile/05667639074146674799noreply@blogger.com0tag:blogger.com,1999:blog-5328807984633140449.post-25038395636157161472012-02-13T17:42:00.000-08:002012-05-09T14:29:22.523-07:00Opinion: Should I use Linux, Mac, or Windows?<br />
<br />
<br />
"A craftswoman never blames her tools."<br />
<br />
For most, whether or not you can get your work done well on a certain platform is all that matters.<br />
<br />
<br />
<br />
<br />
To me, the three major operating platforms are tools that all have strengths and weaknesses. In the same way that I wouldn't use my nice chisels to loosen a laptop screw, I wouldn't use a MacBook for writing code for our Linux infrastructure. I am more efficient doing that work on Linux itself.<br />
<br />
<br />
At the same time, I shoot photos and video, and do some writing to take a break from IT. I've tried doing that work using the included tools on all three platforms. I find the Mac platform the most efficient and trouble-free for that work. I can do the work on Linux as well, but Linux has frustrating workflow gaps - especially regarding video.<br />
<br />
<br />
At work, even though we have a heterogenous server environment, we communicate using Microsoft Office, SharePoint, and Lync. My opinion of those tools does not matter. We chose them for communication and therefore I need them to work well. Thus, at work I use Windows 7 with PuTTY, Gnu Screen, and several Linux VMs to do my Linux systems engineering. At home I use a MacBook with iLife and a Linux VM. These two setups let me use the three PC platforms for the workflows for which they seem best suited. [1]<br />
<br />
<br />
I think it's missing the point to debate which is the one true platform. We all have things we want to do, things we want to create. In my experience, the question is not "which platform is better in general?", it's "on which platform can I most easily get my work done?". If my current platform no longer works well, I try the others. In the end, I'm paid more for getting more work done in less time, so the efficiency of a platform for that work decides the question.<br />
<br />
<br />
<br />
<br />
-Adam Keck<br />
<br />
(a0f29b982)<br />
<br />
<br />
<br />
<br />
<br />
[1] Note that there are six major personal computing platforms today, Linux, Mac, Windows, iOS, Android, and Web, so the landscape is actually more complex. Many tasks that were once the purview of the desktop/laptop platforms have been reimplemented with better workflows on the web and mobile platforms. Some people I know find a decent browser sufficient for all the personal computing tasks they need or want to do. Others use only their iPads for everything.<div class="blogger-post-footer">© 2013 Adam Keck</div>A.K.http://www.blogger.com/profile/05667639074146674799noreply@blogger.com0tag:blogger.com,1999:blog-5328807984633140449.post-55700732952348370492012-01-20T15:03:00.000-08:002012-05-09T14:30:48.014-07:00"cmore": Colorized text paging using vim...<br />
<div>
Sometimes, I want colorized syntax and nice navigation for paging. We can use vim to provide this service. This assumes your terminal client supports the terminal type "xterm-color". If you need another color terminal type, customize accordingly.</div>
<ul>
<li>Install all of the standard vim packages</li>
<li>Add <span style="background-color: rgba(255, 255, 255, 0.917969); color: #222222;"><span style="font-family: 'Courier New', Courier, monospace;">alias cmore="TERM=xterm-color vim -R -"</span><span style="font-family: 'Courier New', Courier, monospace; font-size: 13px;"> </span><span style="font-family: Times, 'Times New Roman', serif;">to your </span><span style="font-family: 'Courier New', Courier, monospace;">~/.profile</span></span></li>
<li><span style="color: #222222; font-family: Times, 'Times New Roman', serif;">Add the following [1] to your </span><span style="color: #222222; font-family: 'Courier New', Courier, monospace;">~/.vimrc</span></li>
</ul>
<blockquote class="tr_bq">
<span style="font-family: 'Courier New', Courier, monospace;"><span style="background-color: rgba(255, 255, 255, 0.917969); color: #222222;">syntax on</span><br style="background-color: rgba(255, 255, 255, 0.917969); color: #222222;" /><span style="background-color: rgba(255, 255, 255, 0.917969); color: #222222;">hi Comment ctermfg=Blue guifg=Blue</span><br style="background-color: rgba(255, 255, 255, 0.917969); color: #222222;" /><span style="background-color: rgba(255, 255, 255, 0.917969); color: #222222;">hi String ctermfg=LightRed guifg=LightRed</span></span></blockquote>
<br />
<ul>
<li>Reload your profile: <span style="font-family: 'Courier New', Courier, monospace;">source ~/.profile</span></li>
<li>Usage: <span style="font-family: 'Courier New', Courier, monospace;">cat some.script.sh | cmore</span> </li>
<li> It's vim in read-only mode, so use <span style="font-family: 'Courier New', Courier, monospace;">:q </span><span style="font-family: Times, 'Times New Roman', serif;">to quit.</span></li>
</ul>
<div>
<span style="font-family: Times, 'Times New Roman', serif;"><br /></span></div>
<div>
<span style="font-family: Times, 'Times New Roman', serif;">[1] I found the default colors to be too dark.</span></div>
<br /><div class="blogger-post-footer">© 2013 Adam Keck</div>A.K.http://www.blogger.com/profile/05667639074146674799noreply@blogger.com0tag:blogger.com,1999:blog-5328807984633140449.post-76629265353913157982011-12-31T15:23:00.000-08:002012-05-09T14:27:31.492-07:00Delete or Change Workplaces and Schools On Facebook Timeline (1/2012 edition)Have a school or workplace in your Timeline you want to get rid of or change? Here is the method that worked for me.<br />
<div>
<br /></div>
<div>
<ol>
<li>Log into Facebook.</li>
<li>Click Profile.</li>
<li>On your Timeline, click "Update Info".</li>
<li>Under "Work and Education", click the "Edit" button in the upper right hand corner of the section.</li>
<li>Each workplace and school will get a box.</li>
<li>In the upper right-hand portion of each box, there is an "Edit" link and a small "x".</li>
<li>Click the "x" and confirm your choice to delete a workplace or school. Click "Edit" to change the workplace or school.</li>
</ol>
</div><div class="blogger-post-footer">© 2013 Adam Keck</div>A.K.http://www.blogger.com/profile/05667639074146674799noreply@blogger.com0tag:blogger.com,1999:blog-5328807984633140449.post-74434566423354377042011-09-25T14:52:00.000-07:002011-10-09T19:37:30.255-07:00Getting pictures in focus with a DSLR (digital SLR) in a nutshell.Higher-end cameras have a number demarcated by the letter "F" that one can set to change the size of the opening (called the iris) that lets light onto the sensor. High numbers make the iris smaller. Optical physics aside, the higher the number, the more of the picture will be in focus <i>and</i> the more light you will need. Likewise, the higher the shutter speed, the more will be frozen in time and the more light you will need as well. So, if you want to capture something that moves fast and have it completely in focus, you need a ton of light, a high F number and a high shutter speed number. Note that a particular lens only supports a particular range of F numbers (called F-stops). You don't have a huge amount of light usually. So you have to find ways to compromise and/or cheat. One way to do this is to use a flash, but that can scare butterflies. Another way is to set the camera to do more processing. This number is demarcated by "ISO". My SLR goes from 200 ISO to 1600 ISO, if I recall correctly. New ones go to 12500! The higher the number, the less light you need, and the more you rely on the camera processor and the quality of the light sensor. Thus to get a nervous butterfly on a cloudy evening, you need to higher-end camera so that you can set the shutter speed, F-stop, and ISO numbers really high, and <i>still</i> get a photo that's not grainy.<div class="blogger-post-footer">© 2013 Adam Keck</div>A.K.http://www.blogger.com/profile/05667639074146674799noreply@blogger.com0tag:blogger.com,1999:blog-5328807984633140449.post-29531628986247675072011-09-14T10:48:00.000-07:002019-08-30T13:37:09.505-07:00A note of caution: Password Checking Sites. Recently, several people have sent me links to check the strength of my password like this: <a href="https://www.grc.com/haystack.htm">https://www.grc.com/haystack.htm</a>. There is a saying today that if you are not paying for a product, you <b>are </b>the product. Since I haven't seen any independent organization that has audited the code of these sites to prove that they are not also collecting passwords, we must trust that they do not keep copies the entered passwords or their hashes. Either these sites all have a large amount of altruism, or they are creating the most precise rainbow tables [1] available on the market. There's nothing like doing statistical analysis on a general rainbow table with real passwords to hone its accuracy. Placing blind trust in a 3rd party with one's passwords is never a good idea. I don't think any bank representative would recommend typing one's account password into an un-audited website to check its strength.<br />
<div>
If you run one of these sites and have had such an audit, please let send me a link to the audit and a link to the organization that did the audit. I will include them here.<br />
<br />
<br /></div>
<div>
[1] Rainbow tables are conveniently structured databases of known password information used for efficiently cracking passwords. <a href="http://en.wikipedia.org/wiki/Rainbow_table">http://en.wikipedia.org/wiki/Rainbow_table</a><br />
<br />
<br />
keywords: hacking, cracking, passwords, security</div>
<div class="blogger-post-footer">© 2013 Adam Keck</div>A.K.http://www.blogger.com/profile/05667639074146674799noreply@blogger.com0tag:blogger.com,1999:blog-5328807984633140449.post-83380965911235401932011-08-01T11:56:00.000-07:002012-05-09T14:27:45.499-07:00How do I convert spaces to underscores in file names and directory names on Linux?Have you ever wanted to change all the spaces to underscores in a directory? After going through various methods, the following is the most reliable way that I have found for bash users. Note, that there are many ways to accomplish this task. These examples should be typed in as a <i>single line</i>:<br />
<br />
<br />
<br />
<pre>find . -depth -maxdepth 1 -name "* *" -exec sh -c 'mv "${0}" "${0// /_}"' {} \;
</pre>
<br />
<br />
Note that <i>'-maxdepth 1'</i> changes spaces to underscores for files, directories, and links in the current directory. Changing that number to 2 or more will change spaces to underscores two or more levels deep in the current file system tree in addition to the current directory. Leaving out <i>-maxdepth 1</i> will change spaces to underscores in the <b>entire</b> tree.<br />
<br />
Note also that the '.' means <i>start in the current directory</i>. You can certainly put other paths in place of the dot. You can even put what is called a <i>globbing pattern</i>:<br />
<br />
<pre>find music* -depth -maxdepth 1 -name "* *" -exec sh -c 'mv "${0}" "${0// /_}"' {} \;
</pre>
<br />
will process only files, directories, and links that begin with <i>music</i>.<div class="blogger-post-footer">© 2013 Adam Keck</div>A.K.http://www.blogger.com/profile/05667639074146674799noreply@blogger.com0tag:blogger.com,1999:blog-5328807984633140449.post-26631051397443307472011-05-31T11:45:00.000-07:002012-05-09T14:30:20.372-07:00Linux command line to find all open files...<h3>
Useful for restoring deleted files that might be held in memory by a running process:</h3>
<pre>find /proc -type l -wholename "/proc/*/fd/*" -exec ls -l {} \; | egrep -v '.*->.*:.*'
</pre>
Have you ever accidentally deleted an active apache log file while investigating an issue? Backups are useless since the last one was the night before. You may be in luck, though! If there is a running process holding that file in memory, you can get the in-memory copy of the file from /proc on Linux. Run the above command to list files currently held in memory by processes. To restore, copy the "symlink" back to its original location. This will get you the file in the state that the particular process has in memory. The <br />
<pre>egrep</pre>
strips out sockets, devices, etc.<div class="blogger-post-footer">© 2013 Adam Keck</div>A.K.http://www.blogger.com/profile/05667639074146674799noreply@blogger.com0tag:blogger.com,1999:blog-5328807984633140449.post-46690445451033975502011-04-05T13:27:00.000-07:002019-08-30T13:37:20.546-07:00Using Google and Bing in Systems Administration - A Brief Note.<h3>
Use both search engines</h3>
<br />
Although Microsoft and Google claim that they do not alter search results to promote their interests, they do. It's not necessarily a bad tactic [1]. Just be aware of the behavior.<br />
<br />
<h3>
General Steps</h3>
<ol>
<li>If you have a general problem, troubleshoot until you have a specific issue/question.</li>
<li>If you cannot figure out the answer, run it through both Google and Bing.</li>
<li>If you get results, it's either known configuration problem or a known issue with your product. Hopefully there will be a solution.</li>
<li>If you get no results, you can generally assume that you are making a common configuration mistake, the solution to which is considered so self-evident that user community of your product doesn't feel it's worth writing up. Re-read your manuals, guides, and tutorials.</li>
</ol>
<br />
See the <a href="http://xkcd.com/627/">XKCD flowchart</a> for a similar process for family IT problem resolution.<br />
<br />
<h3>
No Results At All</h3>
If you get no results on a specific issue search for a product that is specific to a particular domain, it is worth just searching for the product itself. In my professional opinion, if you get no results for the general search, your use of the product might be risky for your organization, depending on your specific circumstances of course. If you get empty searches in Google and Bing, the product is not used by enough users to have been blogged about or to have been the subject of a forum post. Also, it's not well known enough that anyone has cared to review it. You may have trouble hiring administrators for the product, and, if the company has bad tech support, you have no other support options.<br />
<br />
<h3>
Notes</h3>
[1] For example, if Google truly feels its cloud apps are better than Microsoft's, they should list theirs first. Otherwise, they are not acting in their customers' best interests (from their point view). Likewise, for Microsoft.<div class="blogger-post-footer">© 2013 Adam Keck</div>A.K.http://www.blogger.com/profile/05667639074146674799noreply@blogger.com0tag:blogger.com,1999:blog-5328807984633140449.post-63072935627007138132011-03-04T12:49:00.000-08:002012-05-09T14:31:00.457-07:00How to fix this ssh error from a Cisco switch: ssh_rsa_verify: RSA modulus too small: 512 < minimum 768 bits<h3>
Problem</h3>
<pre>ssh user@cisco_switch
</pre>
returns:<br />
<pre>ssh_rsa_verify: RSA modulus too small: 512 < minimum 768 bits
key_verify failed for server_host_key
</pre>
<h3>
Solution</h3>
The modulus of the ssh RSA key pair <i>on the switch</i> is too small. If you have access, generate a new key pair on the switch with a larger modulus.<br />
<h3>
Procedure</h3>
<ol>
<li>Login with ssh protocol version 1 (<i>ssh space dash one</i>): <pre>ssh -1 user@cisco_switch</pre>
</li>
<li>(On the switch): <pre>enable</pre>
</li>
<li>(On the switch): Authenticate to "Privileged Exec Mode" mode on the switch.</li>
<li>(On the switch): <pre>conf t</pre>
</li>
<li>(On the switch): <pre>crypto key generate rsa general-keys modulus 1024</pre>
</li>
<li>(On the switch): Press enter to accept that the current key pair for the switch will be replaced.</li>
</ol>
You now should be able to log into the switch with ssh protocol version 2.<div class="blogger-post-footer">© 2013 Adam Keck</div>A.K.http://www.blogger.com/profile/05667639074146674799noreply@blogger.com0tag:blogger.com,1999:blog-5328807984633140449.post-9787988393999111152010-11-02T13:26:00.000-07:002011-07-06T19:35:56.811-07:00Lingo: Destructive Buy-in<h3>Lingo: Destructive Buy-in</h3><i>Definition</i>: Enough buy-in from employees and/or management to approve an idea or project, but not enough buy-in to execute it successfully.<br />
<br />
Origin: Corporate lore from a now-defunct biotech firm in MA, USA. First seen in an early Scott Adams interview in the form "destructive agreement".<div class="blogger-post-footer">© 2013 Adam Keck</div>A.K.http://www.blogger.com/profile/05667639074146674799noreply@blogger.com0tag:blogger.com,1999:blog-5328807984633140449.post-37964700221771880402010-07-14T07:59:00.000-07:002012-07-08T10:22:19.225-07:00How do I find which package contains a certain file?<h3>
What to do if you need to install or build a package on Linux and it wants a missing file/library/etc...</h3>
Have you ever tried to install package or some vendor software, only to find that the install fails due to a missing library? Here is a collection of methods for finding the package that contains the missing file.<br />
<br />
<h3>
Red Hat Enterprise Linux/CentOS</h3>
<h3>
Using yum</h3>
<pre>yum whatprovides /full/path/to/missing/filename
</pre>
Note: In all of these processes, fill in the actual filename and path for which you are looking.<br />
<br />
<h3>
Using rpmfind site</h3>
<ol>
<li>Browse to http://rpm.pbone.net/index.php3/stat/2/simple/2</li>
<li>Enter filename or /full/path/to/missing/filename in the search box (start with just the filename)</li>
<li>Check boxes of rpm-based distributions in which you want to search</li>
<li>Click search</li>
</ol>
<h2>
Debian/Ubuntu</h2>
<h3>
apt-file</h3>
<pre>sudo aptitude install apt-file
sudo apt-file update
apt-file search filename
</pre>
or<br />
<pre>apt-file search /full/path/to/missing/filename
</pre>
<h3>
Using Debian's website</h3>
<ol>
<li>Browse to http://www.debian.org/distrib/packages</li>
<li>Scroll to the bottom to the section called "Search the contents of packages"</li>
<li>Enter a single argument into the search field, either filename or /full/path/to/missing/filename</li>
<li>Select your distribution</li>
<li>Select the machine architecture for which you need the missing file</li>
<li>Click "Search"</li>
</ol><div class="blogger-post-footer">© 2013 Adam Keck</div>A.K.http://www.blogger.com/profile/05667639074146674799noreply@blogger.com0tag:blogger.com,1999:blog-5328807984633140449.post-41123603746858897842010-05-20T11:02:00.000-07:002010-05-21T08:05:16.586-07:00Rough Sed and Awk Code to Convert a CSV file to a sortable Mediawiki table<pre>echo -e "3,4,5,5\n4,5,6,8" | sed "s/$/\n-/" | sed -e "s/,/\n/g" | sed -e "s/^/|/" | awk 'BEGIN {
print "{|class=\"wikitable sortable\" style=\"vertical-align:top; background:lightblue;\"\n!key value!!col 1!!col 2!!col 3\n|-"
}
{
print
}
END {
print "|}"
}
'
</pre><div class="blogger-post-footer">© 2013 Adam Keck</div>A.K.http://www.blogger.com/profile/05667639074146674799noreply@blogger.com0