Categories
Linux Mac

Use .rev files from the command line

Sometimes, when you download a big multi-part rar file, a part gets corrupted, or it is not even available. Often, however, .rev files are made available, and they’ll let you extract the file even with missing/corrupted parts. In fact, they let you re-create these parts, in a way similar to RAID-5/6 for hard disks.

Rar files

You can use the command line rar tool to do all the job. First, head over to rarlab, the official site, and download the appropriate version for your OS.

On Linux and OS X, you might want to move the binaries into your path, for example into /usr/bin.

Then, cd into the directory where your parts reside (together with .rev files, you need one for each damaged part you wish to recover), and launch:

rar rc yourfile-part01.rar

The rc switch tells rar to ReConstruct any missing parts (I’d advise you to move somewhere else or delete any damaged parts). Point it to part number 1, it’ll figure out the rest. The process can be quite long, more so for big archives, but it’s worth waiting. After it’s done, you can extract your files as usual, or directly using the command line:

rar x yourfile-part01.rar
Categories
Miscellanea

Get pretty date differences in PHP

Today I needed a quick way to get the time difference from an UNIX timestamp to the current date. To get an idea, it’s like the little date you see on Twitter.com, for example “5m” if the tweet was posted 5 minutes ago.

Here’s my quick-and-dirty PHP code, it just takes the timestamp as an input and returns the formatted output. Feel free to fork it and improve it!

Categories
Mac

Improve software RAID speeds on Linux

About a week ago I rebuilt my Debian-based home server, finally replacing an old Pentium 4 PC with a more modern system (which has onboard SATA ports and gigabit ethernet, what an improvement!). It’s based on an Asrock B75 Pro-3M motherboard, an Ivy Bridge Pentium G2020 processor and 4 gigs of RAM.

Storage Server

I migrated all the drives I had in the old server, including the boot drive, so I didn’t have to configure much. The server has a 200 gb IDE boot drive (connected via a 5€ IDE-SATA converter I got off eBay) and 3×2 Tb WD20EARS 2 Tb “Green” drives configured in RAID-5.

Read speed was finally able to almost saturate my gigabit ethernet, but write speed was still disappointingly slow: about 35-40 megabytes/s via AFP and around 65 mb/s directly on the server.

Categories
Mac

How to fix coreaudiod 100% CPU usage

Today, when I booted my Mac I noticed it was really unresponsive, and the fans immediately started going up like crazy. Through Activity monitor, I found the cause for this: coreaudiod was using 100% of my CPU. And force quit did not help.

core_audio_by_rob190975Core Audio is the framework that manages audio on OS X, and it’s awesome, except when it suddenly decides to go crazy and suck all my CPU.

After some googling, I found this post by Axel Jensen, and it literally saved my day.

Basically, for some unknown reason, my /Library/Preferences/Audio/ folder had disappeared, and that really angered coreaudiod. As Axel found, the solution is pretty simple: recreate the folder and set the correct permissions, with just two terminal commands.

sudo mkdir /Library/Preferences/Audio
sudo chown -R _coreaudiod:admin /Library/Preferences/Audio

I did some additional research and found out that it’s also safe to restore that folder from a Time Machine backup, or any other backup really, just make sure to set the proper permissions with the second command above. This way I was able to get my aggregated audio interfaces back, and I did not have to re-create them in Audio MIDI Setup.

Categories
Mac

Some useful Alfred 2 workflows

Today I finally bought Alfred 2, a really nice update. It’s great, but I had to recreate some scripts I got used to while using version 1. You can find them below.

Alfred

 

CopyPath

CopyPath copies the path of the currently selected Finder Item to the clipboard. Just launch Alfred and type “path”. Also, thanks to Joachim’s suggestion, you can now set a keyboard shortcut to trigger the workflow without needing to ever launch Alfred.

Copy IP

Copy IP your current local IP, either Wi-Fi or Ethernet. It includes 3 commands:

  • ethip copies your Ethernet IP
  • wifiip copies your Wi-Fi IP
  • ip [interface] copies interfaces IP. It’s meant for power users. Note: on Macs usually en0 is the Ethernet interface, while en1 is Wi-Fi.

RevMove

RevMove checks your clipboard contents and removes any line containing “.rev”. It is useful if you download from file-hosting sites, such as Netload, because uploaders often include .rev files to their upload to be able to extract your files also some parts were corrupted/not available. But when everything works as it should, these files are pointless and waste time and bandwidth to be download.

MAS Search

MAS Search lets you search for an app in the Mac App Store. Just type mas followed by your search terms.

 

If these are not enough, you can find many, many more in the Alfred 2 Workflow list, which also features my very own CopyPath.

Categories
Mac

Can’t save to Pocket/Instapaper from Tweetbot after changing password

TweetbotPocketInstapaperAfter changing my Pocket password, I could not save any more links from Tweetbot for Mac, not even if I entered the correct password. I have found a solution, though.

The issue is due to a corrupt entry in the keychain, and solving the issue is pretty simple.

First, close Tweetbot and then open the Keychain Access app from your Applications/Utilities folder (a Spotlight search will quickly find it), and type tweetbot in the search field.

Keychain ScreenshotYou will find all of your Tweetbot-related stuff, such as Twitter tokens and, what’s more important, Pocket and/or Instapaper passwords. Just highlight the relevant entry and hit the backspace key. Now you can re-open Tweetbot and re-enter your credentials.

 

 

Categories
Mac

Record multi-track Skype group call on OS X

A friend of mine and I host a weekly podcast and, as it often happens, we speak with our guests via Skype. For a while we had everyone record his own audio, since we wanted to have a separate track for each person in order to get the best possible audio quality. But that was inconvenient, both for our guest and for us, as we had to wait everyone to send us his audio before mixing and editing the episode. Recording Skype’s group call in a conventional way wasn’t a better solution. We’d only have two separate tracks: mine and everybody else’s, This is fine if there is only one person other than me, but it’s not with more guests.
So I started to think on possible solutions, and the best one that came to my mind was to have a separate instance of Skype running for each guest (I’ll explain how to do this later on) and use Ableton Live to record each track and to manage the audio routing.

Ableton Live is quite expensive, though, and if you don’t already have some experience with it that justifies purchasing a license, I’d advise you to check out snkl’s post that explains in detail how to achieve the same result with a much cheaper (but still great) app: Rogue Amoeba’s Audio Hijack 3.

My awesome hand-drawn scheme
My awesome hand-drawn scheme

To manage the audio, we need some sort of virtual audio cables to connect Skype to Ableton Live. The best tool is SoundFlower, so head over to their site, download and install it. However, it is not ready for our purpose right out of the box: we need 2 “virtual audio cables” for each Skype instance, and Soundflower only ships with 2 of them enabled by default (and only one of which, the 2 channel one, is suited for our needs). I managed to edit Soundflower’s plist file to get more.

Categories
Mac

Get Avidemux to run on MacOS X Lion

OS X Lion

After upgrading my Mac to Lion I was very disappointed: Avidemux, my #1 video app crashed upon launch. After a little research on the web, I found a post by eagle007 in Avidemux’s forums that explained that the crash was caused by a library used by Avidemux, libiconv.2.dylib.

He managed to get an updated version of the library and replace the one in the application bundle, thus making Avidemux work again. I really want to thank him for his awesome work.

In case his link goes down, I took the liberty to upload the file here.