How to get md5 hash of files in current directory

The following command pretty useful when you need to get a md5 of specific files e.g. only video files in the current dir.

find * -iname '*.mp4' -exec md5 '{}' \; >output.txt


Does anybody know what '{}' \; means?

How to hide a folder in Finder

In order to hide a folder in Finder, open Terminal and write following:


setfile -a V /path/to/folder

Or

chflags hidden /path/to/folder


To unhide:


setfile -a v /path/to/folder

Or

chflags nohidden /path/to/folder

Update locate database on OS X (updatedb)

In order to update "locate" database on OS X, some people suggest to create a symlink:


sudo ln -s /usr/libexec/locate.updatedb /usr/local/bin/updatedb

However, this method can create an erroneous output if you are in directory with a specific permission e.g.

shell-init: error retrieving current directory: getcwd: cannot access parent directories: Permission denied
shell-init: error retrieving current directory: getcwd: cannot access parent directories: Permission denied
shell-init: error retrieving current directory: getcwd: cannot access parent directories: Permission denied
find: .: Permission denied


The better method would be to create a bash script /usr/local/bin/updatedb:

  #!/bin/bash
  pushd . > /dev/null
  cd /usr/libexec
  echo "Updating locate database..."
  sudo ./locate.updatedb
  echo "Updating complete!"
  popd > /dev/null


Make it executable: sudo chmod +x /usr/local/bin/updatedb

Now you can just run «sudo updatedb», in order to update «locate» database.

Truncating text using only CSS

Here's how you can truncate text using only CSS. It works in IE 6+, Safari 4+, Firefox 7+, Opera 11+ and Chrome 10+:


.link_truncated {
    text-overflow: ellipsis;
    display: inline-block;
    width: 275px;
    white-space: nowrap;
    overflow: hidden;
    vertical-align: top;
}


P.S. from here

Controlling fan speed on Macbook Air (handling noisy fan, by decreasing the fan speed)

Hello all!

Recently I've purchased Macbook Air mid 2011, I very like it so far.
However, I've noticed when I'm watching movies or YouTube videos, the fan is spinning really fast, iStats shows me something like about 6400 (!) RPM.
I've tried to use fan controlling apps like smcFanSpeed or Fan Control.
However, both of those apps doesn't allow you to decrease fan speed (probably it's designed that way in order not to burn the laptop in inexperienced user hands)

I'm kinda experienced user, so I took a risk and wrote simple script that allows you to set fan speed manually.
The instructions are pretty easy:
1) Download it setFanSpeed2011.tgz
2) Open the Terminal, go to folder where the file was downloaded
3) Extract it: tar xf setFanSpeed2011.tgz
4) Go to inside extracted folder: cd setFanSpeed2011
5) Run it: sudo ./setFanSpeed XXXX (Where XXXX should be needed RPM)

P.S. When I'm gaming or watching movies, I found that 3600 RPM work for me pretty well, the CPU stays on ~174F (~79C) temperature.
The same temperature as when fan was spinning at 6200 (!) RPM, but now it's not such noisy!
P.P.S Created and tested on OSX Lion 10.7.1

Disclaimer,
Note, I'm not taking any responsibilities if you will burn your laptop by using my tool! Decreasing the fan speed is very dangerous!
Since, if you don't watch the CPU temperature it might be overheated!

install telnet client on windiws 7 using console

IT may be useful when you need telnet.exe on win7 machine and for some reason want install/enable it using .bat files


pkgmgr /iu:"TelnetClient"

cross-browsed text-overflow

What is text-overflow? http://www.css3.info/preview/text-overflow/

How to implement it nowadays for the most popular browsers?

Here is a solution:

style.css


    .wrapper span
    {
        display:block;
        overflow:hidden;
        white-space:nowrap;
        width:100%;
        -moz-binding:url("ellipsisxul.xml#ellipsis");
        text-overflow:ellipsis;
        -o-text-overflow:ellipsis;
    }


ellipsisxul.xml


    <?xml version="1.0"?>
    <bindings xmlns="www.mozilla.org/xbl" xmlns:xbl="www.mozilla.org/xbl" xmlns:xul="www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
        <binding id="ellipsis">
            <content>
                <xul:window>
                    <xul:description crop="end" xbl:inherits="value=xbl:text">
                        <children/>
                    </xul:description>
                </xul:window>
            </content>
     
        </binding>
    </bindings>

Funny comments in source codes ;)


//When I wrote this, only God and I understood what I was doing
//Now, God only knows 



_margin: 40px; /* hack for IE browser (assuming that IE is a browser) */




( Read more )

CSS file that resets browser defaults

CSS file that resets browser defaults:



html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, font, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td {
	margin: 0;
	padding: 0;
	border: 0;
	outline: 0;
	font-size: 100%;
	vertical-align: baseline;
	background: transparent;
}
body {
	line-height: 1;
}
ol, ul {
	list-style: none;
}
blockquote, q {
	quotes: none;
}
blockquote:before, blockquote:after,
q:before, q:after {
	content: '';
	content: none;
}

/* remember to define focus styles! */
:focus {
	outline: 0;
}

/* remember to highlight inserts somehow! */
ins {
	text-decoration: none;
}
del {
	text-decoration: line-through;
}

/* tables still need 'cellspacing="0"' in the markup */
table {
	border-collapse: collapse;
	border-spacing: 0;
}




Via Meyerweb