How to: Initiate a Timed Shutdown

On Friday I was downloading some files on my Netbook (running Ubuntu Remix 10.04) and was not planning to stick around for the downloads to finish (it was already close to 7pm, I needed to get home for the weekend). I didn’t want to leave it running all weekend and I still had another hour to go before my downloads finished…
What to do?

Well I decided to initiate a delayed shutdown of my system. Since the downloads had about 1hr and 15 minutes left, I decided to be extra safe and set the shutdown for an extra 30 minutes after that… Here’s how I did it:

In your terminal, run the following command:

sudo shutdown -h 20:45 "See you on Monday!"

you can change the time to fit your needs and change the message (between the quotes) to whatever you like or leave it out as the message is optional.

You could also set it to shutdown by using a slightly different format, like this:

sudo shutdown -h +120 "Shutting down in 2hrs -- or 120 minutes"

This works on Linux and Mac. If you want to do this on Windows you could try something like this (if you are an admin):

at 20:45 shutdown /l /r /y /c

But I cannot vouch for how effective this will be (on Windows I mean) as it may only shutdown the OS not the machine/computer…

Google AdSense Account = Disabled?

Just found out the other day that my Google AdSense account has been disabled. They still have not given me a reason or an explanation of why or what violation I am guilty of… As far as I know (and I’m looking over the agreements again) I have not done anything wrong.

I am sure I’m not the only one to experience this…. but it still doesn’t make me feel any better and quite honestly I feel cheated. I suppose I should try appealing, but at the same time I wonder: “why bother”…

Batch Zip and Rename – I love the Terminal!

Today I needed to compress numerous (around 25) directories into individual archives (in this case, zip’s) and then rename them with a different extension (in this case ‘cbz’). This would have been extremely painful to do manually… I mean, right click a directory — one at a time — then left click “compress” (or zip, depending on the context menu)… and I’m not even going to go into renaming (there are at least 3 ways to manually rename a file, and I don’t want to describe them now. If you care to know just ask).

So what did I do? Did I really bother with all of that nonsense?! NO WAY! I have no patience for that!

Here’s the easy way:

1.) First, open your terminal (sorry, this is for Mac and Linux machines only, I don’t have time to convert the code to work on Windows).

2.) Next, navigate to the directory your files are in.

3.) Finally, run this command:

for dir in `ls`; do zip $dir $dir/*; mv $dir*zip $dir.cbz; done

And it’s as simple as that! All done in one easy process, just a few lines of code!

If you just want to do a batch zip, without the rename, use this code instead:

for dir in `ls`; do zip $dir $dir/*; done

I hope that helps someone out there…


Here are a few different methods to try for batch-zipping in Linux:

## zip all files and folders in current directory
zip -r "${PWD##*/}.zip" *

## zip the contents of each folder from the current directory into an archive
for x in *; do if [ -d "$x" ]; then cd "$x"; zip -r "../$" *; cd ..; fi; done

## zip each folder into an archive
for x in *; do if [ -d "$x" ]; then zip -r "$" "$x"; fi; done

## another way to batch-zip
for i in $(find ./ -type d -maxdepth 1);do zip -r9 $ $i; done

## same as above only using tar instead of zip
for i in $(find ./ -type d -maxdepth 1);do tar -czvf $i.tgz $i; done

If only I had more time…

Am I the only one who feels like there is not enough time in a day to accomplish everything there is to be accomplished?

Or maybe that’s just my problem. I can’t seem to focus on just one thing at a time and get that done… Instead I jump from project to project, completing a little here and a little there. I’ve tried To-Do lists, I’ve tried Sticky Notes, I’ve tried minimalistic interfaces, and a whole bunch of other things that are supposed to limit distractions… but no matter what I do I can’t stop my brain from thinking up new and great ideas that I want to work on now!

If only I had more time… Of course in order for this idea to work, I would have to be the only person with that extra time in the day, because if this extra time was available to everyone then the standards of the world would just increase to meet the new time restraints and we’d back to where we were. It’s kind of like how raising minimum wage doesn’t really help anyone, it just increases inflation and hurts the people who had worked so hard to get raises up and away from minimum wage…

So what I want/need is a time increase for just me. And since that will never happen, I suppose I need to find a way to focus and be more productive.

Help Me!

While normally I only post about “Antidotes” or solutions to problems I have come up with, I’m stumped here. So I’m asking you — people of the interwebs — to help me!

If you have a solution to my problem, post a comment below or tweet me (@alexsantidote). Thanks!