VpnInit AppleScript: Override and Restore Default VPN-Routes on OS X

Posted by: gdelmatto  :  Category: Networking, OS X, Operating Systems, Programming, Scripting, Utilities

Years ago I wrote a small script to restore local default route after connecting the RAS VPN on Windows.

Now, I made up a similar script to do the same on OS X.
Read more…

Automating MakeMKV with AppleScript

Posted by: admin  :  Category: OS X, Operating Systems, Programming, Scripting

It’s only days since I wrote about a custom script action upon inserting a DVD in OS X, allowing me have either run the DVD Player or MakeMKV to rip the DVDs.

Now I was digging around if I could do some automation on the GUI part, which indeed turned out to work … at least to a certain degree.
Read more…

Make OS X run custom actions upon DVD insert

Posted by: gdelmatto  :  Category: OS X, Operating Systems, Programming, Scripting

I’m currently ripping my complete DVD collection off to MKV (Matroska) format, so I can stream them across my home network.

So I sought a way to have my OS X give me the choice to either start DVD Player or MakeMKV upon inserting a DVD.
Read more…

Shutting Speakers on OS X when Screen Saver runs

Posted by: gdelmatto  :  Category: OS X, Scripting

Why for God’s sake would anyone even think about shutting speakers while the screen saver runs?
Don’t these thingies provide an internal mute switch to stay quiet?

Well, yes, most of the time, they do. Though in my case, I run that nice and decent System47 LCARS-style screen saver. And while it provides indeed a mute switch, it yet refuses to honor that flag and will always revert to non-muted operations. This drives me crazy, at least during the night time.

So here’s my solution to shut it quiet — really handy when I’m not along and forgot to turn volume down …
Read more…

Print File Contents in Reverse Order (“reverse cat”)

Posted by: gdelmatto  :  Category: Perl, Programming, Scripting

The ‘cat’ utility serves it’s purpose print the content of a file at once. So do ‘more’ and other tools as well. But they all do in ‘forward’ mode only.
To print a file in reverse order, at least some linux distros come with the ‘tac’ command, which will do a ‘reverse cat’.
But what to do, if ‘tac’ is missing?
Read more…

Shell Scripting: How to easily convert UNIX timestamp into date format

Posted by: admin  :  Category: Perl, Programming, Scripting

When writing shell scripts (bash, sh, etc) maybe you had to work with POSIX/UNIX timestamps from time to time.
While the serialized nature of the timestamp is great to work with for scripting, it’s easier for human beings to have them printed in date format.

Before you start digging around using some fancy conversion in Perl, check out the ‘date’ command first.
Read more…

De-Scrambler for obfuscated PHP code

Posted by: admin  :  Category: PHP, Programming, Scripting, Security

Thinking about security risks of obfuscated PHP code found in some freely available PHP scripts and WordPress themes, I wrote a quick’n'dirty De-Scrambler.
Read more…

Trap Errors, Exit Codes and Line Numbers within a Bash script (and some output redirection, too)

Posted by: admin  :  Category: Programming, Scripting, Shells

A discussion today was about error handling in shell scripts, Bash in particular.
Well, we all know about the usual knitpicks about error handling and the possible consequences in not doing so properly ;-)
Read more…

No "sleep" command for batch files? Make it a choice!

Posted by: admin  :  Category: DOS, Scripting, Windows

I just trapped myself while hacking up a batch file.
Used to shell scripting I wanted to add a delay to the batch using “sleep”.

Dough! Bad Idea! Bad command or filename. Smash your head here to continue {(x)}!
Read more…