Auto-lock your Mac, and pause your music when you leave your desk.

Auto-lock your Mac, and pause your music when you leave your desk.

I’m horrible at locking my workstation at work, and I work in an environment of practical jokers who love to play games with unattented workstations.

My solution? EventScrips and a bit of AppleScripting. The event we are going to watch for is a bluetooth device leaving the area.

I’ve configured the scripts to work with ether Radium or iTunes. whichever is running will get pause and play commands.

Here is the setup:

EventScripts

And here are the AppleScripts, The Last one DisableScreensaverPassword is optional I dont like entering my password every time the screensaver is activated. and when my applescript enables the screensaver it sets the passwrod to wake to true first. So when I’m away a password is required to disable to screensaver. I tried disabling the password and screensaver when the bluetoothe device is recognized again but it turns out OS X gets a bit cranky when you try and adjust security settings while the screensaver is activated.

Lock&Pause:

tell application "System Events"
    tell security preferences
        set require password to wake to true
    end tell
end tell

delay 1

if application "Radium" is running then
    tell application "Radium" to pause
end if

if application "iTunes" is running then
    tell application "iTunes" to pause
end if

Play:

if application "Radium" is running then
    tell application "Radium" to play
end if

if application "iTunes" is running then
    tell application "iTunes" to play
end if

DisableScreensaverPassword

tell application "System Events"
    tell security preferences
        set require password to wake to false
    end tell
end tell
No tips yet.
Be the first to tip!

Like this post? Tip with bitcoin!

1PAb9s4iJcTv89MppCfmrknca5d4EcCzKR

If you enjoyed reading this post, please consider tipping me using Bitcoin. Each post gets its own unique Bitcoin address so by tipping you're not only making my continued efforts possible but telling me what you liked.

Regain access to EC2 instance, after a botched sshd_config.

I just made a big mistake. Made a change to the sshd_config on a production server that locked me out. My heart skipped a beat when I lost connection and was presented with

brandons_mbp:~ bleon$ ssh domain

ssh: connect to host domain port 22: Connection refused

This is on one of my clients web servers. But I was able to revert the changes. It was a little complicated but it worked.

I knew the exact lines that needed to be removed just getting to them without connecting to the server was the trick. This is why running on EC2 saved me. I stopped the running instance for the web server and disconnected the volume from the instance.

I fired up a temporary CentOS instance (any *nix instance should work, CentOS just happens to be my favorite) and attached the volume to the new instance as a secondary disk. This allowed me to SSH into the new instance and browse the filesystem of the server I locked myself out of. Now using vi or your favorite editor edit the sshd_config file, shutdown the server, disconnect the volume and re attache it to your web-server instance.

I started the webserver instance and crossed my fingers, and when I tried to SSH in again I was successfull.

It would also be a good idea to create a snapshot of your volume before attempting any of this to be safe. And to test any changes your going to make that could potentially lock you out on a system you have physical access to.

No tips yet.
Be the first to tip!

Like this post? Tip with bitcoin!

16YU8gK5RPJNQdVeyAvEwWg6ec8pZhusuV

If you enjoyed reading this post, please consider tipping me using Bitcoin. Each post gets its own unique Bitcoin address so by tipping you're not only making my continued efforts possible but telling me what you liked.

Fear Not! Reeder Will Not Die With Reader.

Reeder

Yesterday I was browsing my news reader of choice Reader.app and stumbled across an article mentioning the shutdown of Google Reader. This was confirmed when later visiting Google Reader.

Reader

I’ve been using Google Reader for years. I purchased the iPhone version of reader about 2 years ago and after playing with it for about an hour bought the Desktop and iPad versions of the app. Its absolutely my most use application (Alien Blue being next in line). I’ve used other readers but gave up on them because of there inability to sync. I love being able to browse through my various feeds in my office. and then later pick up where I left off on my phone.

My first thought at Reader closing was what am I going to replace it with. But it looks like I won’t have to. Reeder has announced it will not die with Reader. I’ve not been able to find an official source but I’m hearing Reeder will be building its own backend to replace the Google reader service. and it will run on Googles App Engine.

No tips yet.
Be the first to tip!

Like this post? Tip with bitcoin!

1LjYfsm24eTmiUTHtkx1j5PHHCSZ6G93sk

If you enjoyed reading this post, please consider tipping me using Bitcoin. Each post gets its own unique Bitcoin address so by tipping you're not only making my continued efforts possible but telling me what you liked.

Breaking CSS Cache

I built a simple web interface for SolarWinds Orion. I recently converted all the status images that used to be individual files into a CSS sprite to save on HTTP requests. Now instead of grabbing all the stats light graphics one by one the browser only needs to download my sprite image once.

After implementign the change most of my users reported losing the devices status images and just seeing the text in the the status column. Text that due to my CSS changes should be pushed off the edge of the page and not be visable.

It turns out the problem was related to browser caching I recently implemented that caused CSS files to be cached in the browser for a month.

The fix is rather easy I simply need to make the broswer think the CSS file it has in its cache is no longer valid. Changin the name of the file will occomplish this but we don’t want to have to rename all our CSS files.

The v=1 at the end of the filename does just want we wanted, the broswer will now think overrides.css is a new file. This is a variable and with CSS is simply ignored, Now whenever we make changes we can simply increment this file up by one. Browsers will think its a diffrent file and download the new content.

Our Users will now see the changes we made to the CSS in our overrides.css file.

No tips yet.
Be the first to tip!

Like this post? Tip with bitcoin!

1PJ2Co8G5ttKPy4h3iawk9p2bQZa1cjZMr

If you enjoyed reading this post, please consider tipping me using Bitcoin. Each post gets its own unique Bitcoin address so by tipping you're not only making my continued efforts possible but telling me what you liked.

iPhone Home Screen Layout

I have far too many apps, And organizing them is a pain. Currently if you want to start from scratch there is an option in:

Settings > General > Reset > Reset Home Screen Layout

However this setting simply resets the default Apple apps on the first screen to the way a new iPhone would be and then arranges all other apps alphabetically starting on page 2.

This is pretty much useless. And would only take a small change to make it worlds more useful.

My thoughts is instead to keep the reset action the same for the first page. but then toss all apps into folders Alphebeticly based on the application’s category in teh App store.

  • Books
  • Business
  • Catalogs
  • Education
  • Entertainment
  • Finance
  • Food & Drink
  • Games

And so on…

Then, place all apps in each category Alphbeticly in each folder. if you fill up a folder you make another Games, Games 2, Games 3, etc. This would make organizing apps on the iphone so much easier. Thoughts?

No tips yet.
Be the first to tip!

Like this post? Tip with bitcoin!

1HkDSJyjdWVDgah7nrp1JvSa79wwyFvosX

If you enjoyed reading this post, please consider tipping me using Bitcoin. Each post gets its own unique Bitcoin address so by tipping you're not only making my continued efforts possible but telling me what you liked.