Enabling Hot Corners on a Mac

So you got gotten D=

Here’s how you ensure you can quickly lock your mac to prevent folks from giving your computer a cronjob. Just enable hot corners and ensure that it requires a password to unlock. Here’s how:

Step 1: Enable hotcorners

  1. Go into your system preferences (the apple icon in the top left corner of the screen)
  2. Search for “Hot corners” (or just hot will probably do) which should light up “Desktop & Screensaver” stuff like this:
    Screen Shot 2016-04-12 at 3.33.23 PM
  3. Bonk the “Hot Corners” button in the bottom right corner
    Screen Shot 2016-04-12 at 3.33.45 PM
  4. Select your desired corner (I’m using the bottom left corner) and set it to “Start screensaver”
    Screen Shot 2016-04-12 at 3.34.25 PM
  5. Press OK and we’ll return to the System Settings for the next part

Step 2: Ensure the Screensaver requires a Password

  1. Back in your System Settings, search for “Security & Privacy”
    Screen Shot 2016-04-12 at 3.34.55 PM
  2. Then under the “General” tab, make sure the box is checked and set up to either “Immediately” or within “5 seconds” lock your computer
    Screen Shot 2016-05-16 at 1.21.25 PM
  3. If you encounter trouble modifying any of the options, you may need to unlock your settings. Look in the bottom left corner of the settings window and click the lock. You should be prompted to enter your password. Authoritate yer computer and rock on!
    Screen Shot 2016-05-16 at 1.26.26 PM

How it works

Now that you have hot corners enabled, let’s kick the tires, shall we? Move your mouse to the corner that you selected and it should enable your screensaver. Ensure that when it turns on, that it requires a password to unlock. This is a great way to protect yourself against shenanigans, and a good step to help make sure you aren’t the victim of a USBDriveby D=

…fin!

Adding Crontabs to your Coworkers Unlocked Computers

What’s a cron?

Alright, what we’re doing here is scheduling a mac to do something for us using cron. Cron is a program that checks to see if there is anything it needs to do every minute. Once something qualifies, it will execute the code it’s given. But what if the code we give it is…… shenaniganalous in nature? Mwah ha ha ha!!! The possibilities are limited only by your imagination =P

In this example, we’re going to make a job that will repeatedly say “nacho nacho nacho” every ten minutes until the end of time. Seem fair? Alright, the schedule when we’re done will look something like this:

Ready. Set. Cron.

Here’s how it works on a mac:

  1. Open up a terminal on the victim’s computer. You can press the F4 key, type in “terminal” and press enter.
  2. Type in “crontab -e” (without quotes) to edit the current cron schedule for the user.
  3. To add the schedule above in Vim, press “i” – the bottom left corner should say -- INSERT --
  4. Paste in the schedule from above. You can change the text to say something else, but whatever you do, do not use exclamation points. It’s syntax in bash and will not work!
  5. Once you have your schedule pasted in and it’s perfectly crafted, press escape, then type “:x” (which you’ll see in the bottom left) and press enter — this will save your new schedule and exit Vim

It will tell you if it fails, otherwise, consider your plan in progress! Quit the terminal and wait.

Cleanup

Alright, so the joke is done, and if anyone hears your victim’s computer say “pee pee” one more time, …no wait it’s still hilarious. Ok, let’s say you want to remove it anyway, right? If they don’t have any crons they need to save, there’s a simple way to do it.

Open up the terminal again and type the following (WARNING: it will clear ALL CRONS on the machine!):

Now, if you’ve come across the rare person who has something in their crontab, you can simply edit their crontab again and remove the magnificent job you added like this:

  1. Open up the terminal and type crontab -e
  2. Using ‘j’ and ‘k’, you can navigate to the line that needs to be removed
  3. Once on the offending line, you can type ‘dd’ (yep, two of em) to delete the entire line
  4. Once the schedule is gone, type “:x” to save and quit vim and you’re set!
  5. Hit cmd+q and close the terminal as if nothing ever happened.
  6. Flex.

What else, Ryan?

…yes! A quick reference for you!

Great question! I’m so glad you asked! There is SO MUCH MORE we can do.

View current cron tasks
crontab -l (that’s an “L” to “List”)
Remove all current scheduled tasks
crontab -r
Schedule to open a google search for nachos every 10 minutes
*/10 * * * * ( /usr/bin/open "https://www.google.com/webhp?#q=nachos" )
…hey I get it. Sometimes, you just need some nachos.

More fun with Say

Say comes with a lot of different options… have a look using man say in your terminal to see the manual. Now when you look at this, if you have any questions on how to use some of these options, you can ask!

For instance, let’s say I’d like to use a different voice… but I don’t know which ones I can use. Ask yer mac like this: say -v ?

This will give us a massive list of voices to choose from. Now you can switch up your command to do things like:

The above schedule, on exactly the 14th minute of the hour, will creepily whisper “I can see you”.

Conclusion

Here we’ve explored three tools (crontab, say, and open) that in coordination can help you mess with unlocked computers. I give you this knowledge knowing full well it could be used against me……… but then again, I lock my computer =P

Blog Spammer Shootin’ Match

The Stage

For some reason….. this blog — THIS blog! …..gets a crap ton of spam. So I went looking. I figured I’d share the bulk of what I found.


Yep. If you’re getting crazy spam, watch out for China, obama, and nofollow. They. Will. Destroy. Your. Sanity.

The Apology

If you legitimately are trying to comment and noted something about any of the three mentioned above, I owe you an apology. I’m sorry I shot your comment in the spam box with glee and a special kind of whimsy.

Looking at the Data, Again!

I kinda enjoy using this as a psuedo “comment honeypot” because it’s just so darn entertaining. Here are some other fun ways to look at your comment spam:

By number of comments posted per IP:

Original IP’s censored b/c I don’t wanna be a jerk to anyone but the guy at 123.45.67.89!

By my patented, foolproof, never wrong Offender Rating System®:

Again, original IP’s censored b/c I don’t wanna be a jerk to anyone but the guy at 123.45.67.89!

…fin!

Wasn’t that fun?! =D

Don’t spam me, bro!

Getting a quick summary on your MySQL Database

Summary of yer tables

Sometimes, you just want to see what’s going on from a high level. “HOW CAN I GET A SUMMARY OF MY TABLES?!” you may have asked yourself…

To do this, you’ll need to do a simple query into the TABLES table in the information_schema database. Like this:

It’s a habit for me, but I always like to describe the table so I know what I’m looking at:

Now, we can see what we’re looking for. Here’s what I generally like to do:

Yeah, even my schema names are trendy and clever.</sarcasm>

Anyways, now you can sort and/or select however you want! Grok yer data, amigo. =]

I realize my code blocks are not blocking well enough. Will fix.

Performance Issue Gut Check for MySQL

Sometimes MySQL performance can be difficult to hammer out. One of the quickest ways to get a good gut check is to have a look at the current process list. Check this out:

Now, this is relatively uninteresting, but sometimes, you’ll find a list of active queries that have stacked up against your db. Some things that can really help you identify issues is by ensuring each different piece of your platform identifies itself uniquely.

Once that happens, you can see which queries from where are hanging on. Parts of your platform can stall and hold onto connections, queries can take an eternity, bad code can hold result sets in memory, etc… This should give you a good idea where to start looking!

Hope this helps =]