Leaking Pipes with Swift and External Executables

Observed with MacOS 12.4/Xcode 13.4.1/Swift 5

There are quite a lot of tutorials out there covering the basics of running external executables from within Swift and, with very little effort, it’s quite easy to throw together something like this…

import Foundation

let wrappedUname = Process()
wrappedUname.executableURL = URL(fileURLWithPath: "/usr/bin/uname")
wrappedUname.arguments = ["-v"]
let unameOutputPipe = Pipe()
let unameErrorPipe = Pipe()
wrappedUname.standardOutput = unameOutputPipe
wrappedUname.standardError = unameErrorPipe
do{
    try wrappedUname.run()
} catch {
    print("Unexpected error: \(error).")
}
wrappedUname.waitUntilExit()
let unameOutput = String(decoding: unameOutputPipe.fileHandleForReading.readDataToEndOfFile(), as: UTF8.self)
let unameError = String(decoding: unameOutputPipe.fileHandleForReading.readDataToEndOfFile(), as: UTF8.self)
print("Output: " + unameOutput)
print("Error: " + unameError)
Continue reading “Leaking Pipes with Swift and External Executables”

Headless RDP for Fun and Profit

This solution has been checked on Windows 2019 fully patched as-of spring 2022. Other Windows variations may require tweaks. Those on *nix-based platforms looking to create a headless connection to a Windows host should skip the Windows related initial instructions.

Why?

Some applications are just not suited to running as a Windows Services – indeed some applications, such as those which require a full Windows desktop context, cannot be run as a plain Windows Service. One of the possible ways to get around this limitation is to run them under a fully scripted remote desktop instance – the remote user receiving a standard Windows Desktop experience with all the pros and cons this entails – however the default client available on Windows does not allow such a headless connect. Fortunately, newer releases of Windows – including Windows 2019 and Windows 10 – are able to run several versions of Linux as applications.

Continue reading “Headless RDP for Fun and Profit”

Sending Chrome Tabs to get_iPlayer on MacOS via the Command Line.

It’s a pretty simple command line…

osascript -e{'set text item delimiters to linefeed','tell app"google chrome"to url of tabs of windows as text'} | grep -E 'www.bbc.co.uk/programme|www.bbc.co.uk/iplayer/episode' | xargs -t -n1  get_iplayer --pid-recursive
Continue reading “Sending Chrome Tabs to get_iPlayer on MacOS via the Command Line.”

Retro Tea Breaks 1 – A Book to Preserve Video Game History

I’ve been watching the RetroManCave YouTube channel for a while and, when Neil Thomas (the chap who runs it) announced that he was going to launch an edited volume of his interviews with various pioneers of the computer and gaming industry, I figured that it was time back my first Kickstarter.

It looks like it should be a good quality product on an interesting set of topics and I’m looking forward to receiving my copy in November.

Anyway, the Kickstarter for Volume One can be found here. Do hurry, the backing ends on the 13th of August.