/usbkey/shadow so we can change the root password for the global zone after install. Here’s how:
- Fire up a console or ssh session as root in the global zone
Check the existing permissions on the file
$ ls -l /usbkey/shadow
-r-------- 1 root root 560 Oct 19 16:45 /usbkey/shadow
Make the file writable
$ chmod 600 /usbkey/shadow
vi to edit the file
$ vi /usbkey/shadow
Edit the line containing root to change the crypted password. See
shadow(4) if you need help with the format of
/etc/shadow & use
/usr/lib/cryptpass to generate a hash for the password you desire. (Remember to clean the bash history!)
Save the file and exit
Make the file readonly again
$ chmod 400 /usbkey/shadow
Double check permissions are correct on the file again
$ ls -l /usbkey/shadow
-r-------- 1 root root 560 Oct 19 16:49 /usbkey/shadow
Job done. Verify by logging in as root (invoking
/usr/bin/login from an ssh session makes this easy to verify.)
There’s a few community-provided patches for SmartOS that enable KVM on AMD processors amongst other things, and given the HP Microserver has an AMD processor, that’s quite useful for turning it into a better lab server. The main list of so called “eait” builds was hiccuping when I tried to download the latest, and all I could find was a 20140812T062241Z image here.
The source code for the eait builds is maintained at https://github.com/arekinath/smartos-live, and you can see the patches applied on top of the normal SmartOS master by going to https://github.com/arekinath/smartos-live/compare/joyent:master...eait.
So here’s how to use SmartOS to compile a more up to date AMD-friendly Smartos!
Grab the latest multiarch SmartOS image (which has to be used, or the compile will fail.) The latest at the time of writing was
4aec529c-55f9-11e3-868e-a37707fcbe86, so that’s what I’ll use.
imgadm import 4aec529c-55f9-11e3-868e-a37707fcbe86
Spin up a zone for us to build in (the Building SmartOS on SmartOS page has extra info about this):
}' | vmadm create
Login to the created zone:
zlogin <uuid from `vmadm create` output>
Update the image to the latest packages, etc:
pkgin -y update && pkgin -y full-upgrade
Install a few images we’ll need to compile & package SmartOS:
pkgin install scmgit cdrtools pbzip2
Grab the source code of the fork containing the patches we want, from arekinath/smartos-live
git clone https://github.com/arekinath/smartos-live
src/Makefile.defs and change
PARALLEL = -j$(MAX_JOBS) to
PARALLEL = -j8 to do less at once. (Microserver only has a dual core CPU!)
Copy the configure definition into the right place and start configuration:
(You’ll probably get asked to accept the java license during configuration, so keep half an eye on it)
Once configure has completed (which doesn’t take too long, 15 minutes or so), start building:
gmake world && gmake live
Once the build is successfully finished, time to package an iso & usb image:
Hey presto, you’ve a freshly built AMD-friendly SmartOS build to flash to a USB key / put on your netboot server and boot your Microserver from!
My first Olympic distance triathlon, and the first time I’ve ever run 10km to boot.
1500m Open Water (Freshwater Lake) Swim: 00:38:08
Equally happy and upset with my swim. Basically everything went well except my wetsuit, must get a proper swimming one (possibly sleeveless) before my next wetsuit event. Having to get out at the end of each lap and run down the bank to re-enter the water was a bit strange but not too bad. Worst bit of that was diving back in and forgetting to look down - goggles bruised the edge of my eyesocket!
Transition 1: 00:03:53
Took this at a sedate pace, didn’t rush but didn’t dawdle either. Perhaps could’ve gone a bit quicker but not unhappy with it. Found bike OK this time, although chain fell off as I went to mount which was slightly annoying.
40km Cycle: 01:28:49
Started off really badly, managed to knock my watch from cycle into Transition 2 before I’d gotten out the car park. Had to reset it quickly into just bike mode from multisport mode which wasn’t too bad to be fair, just annoying. Having done the route in training was a big help on the day, I was aiming for about the time I did it in. Didn’t push too hard on the two hills (one of which looks deceptively easy). Very happy with my time and more importantly how little effort it was comparatively.
Transition 2: 00:01:28
Quicker than T1, as normal. Got my shit on quickly, didn’t forget anything and even managed to get my watch in run mode whilst jogging to the exit of the transition area.
10km Run: 01:18:40
The bit I was dreading the most. Very very happy with my performance here though. Walked about 90 seconds of the whole thing and kept plodding away the rest of the time. Given the furthest I’d run solidly in training was about 5.5km, I was exceptionally happy to just keep plodding the whole time. Managed to not take on liquid for the third lap, which lead to some impressive cramping in my right quad, so making sure I take liquid on is a definite thing to watch out for in future. And amazingly I wasn’t even tail end charlie (not that it really matters, given I race the clock, not other people. But still.)
There’s a tiny part of me that’s gutted I didn’t manage it in under 3:30 hours, but what’s 51 seconds over that period of time. More importantly, I completed the bloody thing! Especially happy with the run, enjoyed the cycle even if it was trying to drown us (there was 6” deep standing water on one of the roundabouts by the end), and mostly happy with my swim.
Looking forward to returning next year and beating 3:30!
I noticed this morning that my volume down button (-) wasn’t working on my iPhone 5 running iOS 7. Pushing the physical button in didn’t change the volume. The volume up button increased the volume successfully still.
As is my normal first step debugging iPhone weirdness, I rebooted the phone by turning it off, leaving it off for a few seconds, then booting it back up with the power button. Once powered off and on in this way, the volume down key still didn’t decrease the volume.
Fearing a physical button issue at this point, I turned to google for suggestions on what else to try. Running across this thread on Apple’s discussion forums, I tried out the solution in there.
- Open “Settings”
- Scroll down and tap on “General”
- Tap on “Accessibility”
- Scroll down to the bottom and tap on “AssistiveTouch”
- Tap the toggle for AssistiveTouch to turn it on, and you should see a little icon appear on screen (white circle contained in a dark grey rounded square)
- Tap the AssistiveTouch icon (was in the top left corner on screen for me)
- Tap on “Device”
- Tap “Volume Down” a bunch of times and you should see the volume being turned down
- Tap outside the AssistiveTouch dialog to close it
- Try pushing the physical Volume Down button
In my case, following these steps made my physical volume down button start working again. Makes me wonder if the solution author on the apple discussion thread is right, in that this is a software issue and forcing a volume down action through the on-screen interface makes it remember that there’s a physical button to respond to as well.
Either way, I can stop deafening myself whenever I receive a notification now!
Turns out you can run a swift file without having to compile it into a binary somewhere and then run that binary. Makes swift behave a bit more like a scripting language like ruby or python when you need it to.
xcrun binary, we can reach into the current Xcode
/bin folder and run binaries within there. So
xcrun swift lets you run the swift binary to compile files for instance. If you view the help with
-h, there’s a useful flag
-i listed there:
-i Immediate mode
Turns out immediate mode means “compile & run” in the same command, which is what we’re after.
$ cat hello.swift
$ xcrun swift -i hello.swift
Bingo. But what if we want to make hello.swift executable and call it directly without having to know it needs the swift binary to call it. Unix lets files define their shebang to say how the file needs to be executed, so lets go for that here too!
$ cat hello2.swift
#!/usr/bin/env xcrun swift -i
println("Hello World 2")
$ chmod +x hello2.swift
Hello World 2
No more having to fire up Xcode for quick CLI tools, especially ones using the system frameworks!
Successfully completed my second Sprint Triathlon of the season in Nantwich.
500m Swim - 00:10:49
Felt good swimming this. Mixed up my usual breaststroke with some front crawl to overtake and use my legs less towards the end. Think I need to put a shorter time down on paper next time though, was in with people who were swimming much slower than me. (Including one chap who was doing doggy paddle in the deep end and walking as soon as his feet touched bottom. Oh well!) Need to continue with front crawl practice, and aim to do next sprint tri entirely crawl.
Transition 1 - 00:02:43
Went well. Ran from pool to bike and felt OK. Kit on without any fuckups. Didn’t fall off getting on bike. Winning. Need to practice getting on my bike in shoes at a run though.
20km Bike - 00:42:31
10 minutes quicker than same length course last year. (Although a slightly new route this year.) Lost a minute when my water bottle fell out about 12km in though. Barely saw a soul, got stuck at one pedestrian crossing on red. Felt very good on the bike (and finally beat Liam on the same route & day ). Need to fit a tighter bottle carrier to stop the bottle falling out on bumpy roads.
Transition 2 - 00:01:21
Came off bike well and ran to shoes. Couldn’t find where I’d left them, was trying to find Liam’s bike as my marker for it, only someone else earlier in the same row had the same bike as him! Wasted 10 seconds looking probably. Need to remember where my stuff is more accurately in future.
5km Run - 00:39:03
Boiling hot by the point I started running; didn’t feel great in the first few hundred meters and never really got comfortable after that. Walked about 800m of it in total at a guess, really didn’t have much left in my legs. Not convinced pushing less on the bike would’ve helped my run though. On the plus side, only 7 minutes slower than a training run a couple of weeks ago in similar heat, and this was on grass. Need to continue running at 5km distance, and train on grass as well as tarmac I think.
Total time - 01:36:27
8 minutes slower than York a couple of months ago, and felt much worse on the run. Very happy with my bike & swim though. More run training required!
Completed the York sprint distance tri in 1:28:37 total, and didn’t die in the process. Split times & my thoughts below..
400m Swim: 00:08:08
18km Bike: 00:38:43
5km Run: 00:38:08
(Amusingly the official time for my swim was 00:10:10, which then makes my official time for T1 00:00:38; Fastest Swim/Bike transition time in the tri on paper! Ahem.)
Happy with my swim, not much different from training speed & felt good getting out the pool. T1 was okay, and I remembered to put my tshirt on before my helmet this time! Quite happy with my cycling, got down on the drop bars going downhill with tailwind, and could maintain 16mph uphill on the return leg, the bike itself had a major service 2 weeks ago and I’d not really ridden much since that either. Legs responded with life in them coming off the bike, second transition was quicker than expected (elastic laces win!). Moderately happy with the run, was hoping to do it in under 40 minutes (and did), but still felt like I had no more distance/pace left before halfway through. Pushed through to the end okay, and didn’t walk at all. Overall very happy for my first sprint distance, and especially happy to be running 5km after swim/bike without walking.
First event of the season done. Main area to work on is my run, but that’s been the case since last season. Winter running training seems to have paid off so far.
- Quit Google Drive app
- Rename “~/Google Drive/” to whatever you want
- Open Google Drive and wait for it to complain the folder is missing
- Click the menu item and click the warning item
- Click “Locate Folder..” button on the right in window that pops up
- Find your renamed folder and hit OK
- There is no step seven
One piece of a larger puzzle I’m trying to solve currently, was how to add a given URL to my Apple “Reading List” that is stored in iCloud and synced across all my OS X and iOS devices. More specifically, I wanted to add URLs to the list from my mac running Mavericks (10.9). I had a quick look at the Cocoa APIs and couldn’t see anything in OS X to do this. (iOS has an API to do it from Cocoa-land it seems though.)
I figured Safari.app was the key to getting this done on OS X, given it has the ability itself to add the current page to the reading list, either via a keyboard command, a menu item, or a button in the address bar. One quick mental leap later, and I was wondering if the engineers at Apple had been nice enough to expose that via Applescript for me to take advantage of.
One quick stop in “Script Editor.app” later, and I had the Applescript dictionary open for Safari.app. Lo and behold, there is rather handily an Applescript command called “add reading list item”, which does exactly what I want. It has a few different options you can call it with, depending on whether you want Safari to go populate the title & preview text, or if you want to specify it yourself at save-time.
As I want to be able to call this from multiple runtimes, I’ve chosen to save it as an executable, which leans on
osascript to run the actual Applescript. And here it is:
on run argv
if (count of argv) > 0
tell app "Safari" to add reading list item (item 1 of argv as text)
Save it as whatever you want (eg.
add_to_reading_list), make it executable (
chmod +x add_to_reading_list), and then run it with the URL you want saving as the first argument.
$ add_to_reading_list "http://caius.name/"
$ add_to_reading_list "http://google.com/"
# … etc …
(Adding support for specifying preview text and title is left as an exercise for the reader!)
Have fun reading later!
“Fun” triathlon (super sprint distance) done in Nantwich. First ever Triathlon, 7 months after starting training properly.
200m swim: 00:04:08
Despite feeling like I was going super slow. Brine pool was fairly nice.
20km bike: 00:52:31
Pretty happy with that, strongest discipline for me anyway.
2.5km run: 00:21:08
Walked 2/3s of it at a guess. Really hate running, so happyish with this. Need to work on running over the winter.
Total: 1h 17m 47s
BOOYA. Enjoyable. Pretty damn happy with that (had a vague plan of being under 1h30m. So yay.)