Archive for ‘Tricks’ Category
Browse:
Tricks »
Subcategories:

CLI commands that let you access meta data of all files in OSX

datePosted on 14:29, July 31st, 2012 by Many Ayromlou

Two small commands with huge possibilities:

  1. mdls 
    usage: mdls [-name attr] [-raw [-nullMarker markerString]] [-plist file] path
    list the values of one or all the attributes of the specified file
    -raw: don't print attribute names before values
    -nullMarker: substitute this string for null attributes in raw mode
    -plist: output attributes in XML format to file. Use - to write to stdout
    option -plist is incompatible with options -raw, -nullMarker, and -name
    example: mdls ~/Pictures/Birthday.jpg
    example: mdls -name Keyword ~/Pictures/Birthday.jpg
  2. mdfind
    Usage: mdfind [-live] [-count] [-onlyin directory] [-name fileName | -s smartFolderName | query]
    list the files matching the query
    query can be an expression or a sequence of words
    
    	-live             Query should stay active
    	-count            Query only reports matching items count
    	-onlyin <dir>     Search only within given directory
    	-name <name>      Search on file name only
    	-s <name>         Show contents of smart folder <name>
    	-0                Use NUL (``\0'') as a path separator, for use with xargs -0.
    
    example:  mdfind image
    example:  mdfind -onlyin ~ image
    example:  mdfind -name stdlib.h
    example:  mdfind "kMDItemAuthor == '*MyFavoriteAuthor*'"
    example:  mdfind -live MyFavoriteAuthor

Everything you ever needed to know about OSX launchd

datePosted on 14:22, July 31st, 2012 by Many Ayromlou

Great in-depth article by Nathan Grigg. Everything you ever wanted to know about launchd and how job scheduling can be easily done under OSX.

If you try to install Ubuntu 10.10 under parallels desktop 6.0 on OSX — atleast as of the writing of this article — you’ll soon discover that although your entire installation is done in a high (eg: 1920×1080) resolution, as soon as the install is done and you reboot, your VM is stuck at 1024×768. You can install the parallel tools using the menu option and it still won’t help — although it helps with 3D (ie: compiz). Under Gnomes System/Preferences/Monitors the highest resolution available is 1024×768 :-(. After searching around the net for the past week or so and trying just about every remedy — which did not work — I was about to give up, then I found the magic command that “makes it go” :-).

I’ve now got Ubuntu 10.10 running with PT/compiz under parallels 6.0 @ 1920×1080. No problem. Normally if you go inside ~/.config/ directory (.config folder under your home directory) you’ll notice that there is no “monitors.xml” file in there. That’s the per user X config file that gets the ball rolling. Generating the file is really easy. Open a teminal and issue the following command:

xrandr

This will generate (hopefully) the following output:

Note that 1024×768 is the default. Now if you go inside ~/.config/ directory you’ll find a “monitors.xml” file (below). Once you’ve got this file you can go to System/Preferences/Monitors and choose the higher resolution options (eg:1920×1080). The xrandr command should generate the file for you. If it doesn’t (not sure why), here is my version for parallel 6.0. I think it’s pretty generic so you should be able to cut and paste the content:

<monitors version="1">
  <configuration>
      <clone>no</clone>
      <output name="default">
          <vendor>???</vendor>
          <product>0x0000</product>
          <serial>0x00000000</serial>
          <width>1920</width>
          <height>1200</height>
          <rate>60</rate>
          <x>0</x>
          <y>0</y>
          <rotation>normal</rotation>
          <reflect_x>no</reflect_x>
          <reflect_y>no</reflect_y>
          <primary>no</primary>
      </output>
  </configuration>
</monitors>

How to install Office 2010 on Windows XP x64-bit edition

datePosted on 15:17, September 23rd, 2010 by Many Ayromlou

Let me guess…..you tried it and it failed. Well, there is a way (probably not sanctioned by MS) to get this done. I’ve installed it on two separate machines and verified that it works. First you need to download MSXML 6 from Microsofts website. Just go to microsoft.com and search for MSXML. There should be a link to MSXML6.0 download. Download the 64-bit version of the software and install it. Then force a windows update by choosing windows update from the start menu. You will notice a bunch of updates for MSXML. Let it update the files and reboot after that’s done.

Now you need to get the x86 version of office 2010 off the cd and copy it onto your computer somewhere (I just dragged the folder onto my desktop). We need to modify something and you can’t do that on the CD/DVD. Once the copy is done, find setup.exe right click on it and choose properties. Under the Compatibility tab choose “Run this program in compatibility mode for:” and choose Windows XP from the pull down.

Click Apply/Okay and double click setup to run it. That’s it. It works…..Happy days are here again :-).

Yes, we all know Windows task manager sucks. So I set out to find a decent replacement and that’s when I came across System Explorer. It’s FREE and it rocks. Here are the major features:

  • Detailed informations about Tasks, Processes, Modules, Startups, IE Addons, Uninstallers, Windows, Services, Drivers, Connections and Opened Files.
  • Easy check of suspicious files via VirusTotal or Jotti service.
  • Easy search details about file/process via online databases.
  • Security Extension for automatic check of processes,modules and selected files.
  • “New Task…” dialog with integrated AutoSearch and AutoCompletion.
  • Action History for monitoring processes activities.
  • Performance graphs for monitoring usage of system resources in time.
  • System Snapshots for easy finding of system changes.
  • System Report builds rich text report containing major informations about your System.
  • Multilanguage and Plugins Support.
  • Can be used as Task Manager replacement.

It’s the best one I’ve come across and it actually makes me a bit jelous — you know, not having it in OSX and all — so go grab it and let me know what you think. It comes in installer or portable version (for your USB stick) and as always, if you know of a better progy, send me a comment.

FastCopy…..Lightning Fast….

datePosted on 16:43, October 26th, 2008 by Many Ayromlou

Just came across this program in my desperate search for a faster copying program. I recently purchased a “small” 4TB NAS from QNAP and I’ve been busily filling it up with my FLAC collection lately. The trouble with this is that it takes windows far too long to even start the copying process — let alone the actual file copy. Well that’s were FastCopy comes in handy, by bypassing MFC and only using Win32 API FastCopy is truly fast, even to a network device like QNAP. I’m now getting around 7.8-8.2 MB/s compared to 5-6 MB/s before FastCopy (this is on a 100 Mb/s connection). Don’t believe me, try it , it’s Free.

SSH Tunneling to mysql server using Putty

datePosted on 12:55, September 25th, 2008 by Many Ayromlou

 I’ve had this question a couple of times in the past few months (since I posted the command line version of this method here ). To make it short and sweet, yes you can use Putty in a windows environment to setup ssh tunnels. Here is the specific scenario with pics for setting up a tunnel to your mysql server (assuming mysql server is running on a machine that you have ssh access to) using putty. This allows you to run mysql-gui-tools under windows and connect thru ssh to your server, without having to open the server to accept connections from the network.

  1. Download Putty full install package 
  2. Run putty and your’ll see the following screen. Fill in the hostname of the DB server and choose SSH as protocol.
  3. Go down to SSH and Tunnels options. Fill in 3306 for Source port, 127.0.0.1:3306 for local Destination port and click Add. This will forward (through SSH) all traffic sent to 127.0.0.1:3306 (aka. localhost:3306) to the remote host’s (DB Server) port 3306. You’ll see how this works in a second.
  4. Now go back to Sessions, Give the session a meaningful name (eg: MYSQLTunnel) and click Save so that it’s saved.

So now you’re done. If you need to access your mysql server, first run putty, load the session we just saved, connect and you’re good to go. You can use any network based mysql frontend and even the ODBC connector under windows and point them at host: 127.0.0.1 and port: 3306, the SSH tunnel will then take the traffic and safely transfer it to your mysql server box. This way you can run your mysql server in local mode — where it will not accept connections from outside network — for safety reasons and have network access to it when you need.

Speed up Mac OS X Mail application…..

datePosted on 17:07, September 22nd, 2008 by Many Ayromlou

Does your OSX Mail app crawl when you start it. Well here is a quick tip to speed things up again. Just issue this command from a terminal window (make sure you’re not running Mail app first).

sqlite3 ~/Library/Mail/Envelope\ Index vacuum;
You should notice a bit of a performance improvement the next time you start the Mail application. This only works for the OSX mail.app, not other mail applications.

Yep, as weird as that sounds, by cascading your startup items load time (ie: most of the stuff that gets loaded into your system tray) you can actually speed up windows boot times. When Windows loads it’s Startup file, it attempts to load every program in there at the same time. Therefore if you have quite a lot of programs starting when Windows starts, each program will try and grab CPU time so that it can load and that makes windows Craaawwwwllllll.

Startup Delayer allows you to setup how many seconds after Windows has started, to load each program. This little freebee — for example — allows you to load that really really important (yeahright) “iTunesHelper.exe” program later in the boot process. Let’s face it half the crap that gets loaded during windows boot process are not actually needed right when the user logs in. So delay that IMAP/POP Email checker, push itunes/quicktime/adobe air/adobe pdf and all the other junk to a later load time and watch windows rock!!! Finally.

Remote OSX server install via Apple Remote Desktop or VNC….

datePosted on 12:11, August 28th, 2008 by Many Ayromlou

Came across this issue a few weeks ago and never got around to posting it until today. Yes, you can avoid using the Server Assistant program and go straight to ARD to install your server. For this to work your server and remote desktop machines need to be on the same subnet. You boot the server using the 10.5 CD/DVD and note it’s serial number. Now you need to find out the IP address of the server and connect to it from your remote desktop machine. For this, you can run ARD and scan the subnet and find your new server. Once you’ve found it connect to it and login using the first eight characters of the machines serial number and leave the username blank. This even works from Windows/Linux machines using VNC which is great for those who use Windows/Linux on their desktop.

12345Next