More things I can’t remember.

Manipulate a phone number

To change a phone number from a string of digits, e.g. 8051230123 to a formatted value e.g. 805.123.0123 you can use the following grep pattern to parse the string


([0-9]{3})([0-9]{3})([0-9]{4})

and

\1\.\2\.\3

to replace the parsed string with dots.

Tar up a folder

Someone wrote this up for me years ago and I still refer to it from time time.

Assuming you want to copy the site onto your local machine:
The following will tar and compress up the entire www tree and
put the archive file in your home directory (on the server).

cd /; tar -czvf ~/www.tgz www

to decipher:
tar – tape archiver
-c – create new archive, write supplied files too it
-v – verbose – print out names of files as they are added to archive
-z – compress archive using gzip (gnutar only, as used on OS X)
-f ~/www.tgz – write output to file www.tgz in home directory
www – the file to include in the archive

To extract it again:


cd /where/you/want/it; tar -xzvf /path/to/www.tgz
 

will unarchive the www tree under the directory /where/you/want/it

Wordlist

My favorite words list has formatting in the CSS to make the first word of the definition (the part of speech) capitalized.


.definition p:first-line {
  font-weight: bold;
  font-variant: small-caps;  
}

Some words can be used as Verbs and Nouns, or Verbs and Adjectives, so I need to change the formatting of the part of speech.


<span class="boldSmallCaps">Adjective</span><br />

So the part of speech is now formatted with this CSS

.boldSmallCaps {
  font-weight: bold;
  font-variant: small-caps;  
}

Frequencies for equal-tempered scale

Link

Prevent your ISP from redirecting mis-typed URLs

My ISP started to hijack mis-typed URLs and open up their search engine page—which makes it difficult to correct typos. You can bypass your ISPs DNS server by using OpenDNS (208.67.222.222 , 208.67.220.220) or Google Public DNS (8.8.8.8 , 8.8.4.4 ). If you are using OSX, open up the Network Panel in System Preferences and then click on the Advanced button. In the DNS tab, replace the default IP address with one of the ones above.

Block access to javascript from Tynt, the Copy/Paste Jerks

For my word of the day I frequently copy a sentence with the target word and lately I’ve noticed that I get the URL with it. It’s annoying to delete the URL and apparently it annoys John Gruber too. The solution is to edit your /etc/hosts file and block their server. Add this line to the end:
127.0.0.1 tcr.tynt.com

Make files invisible

SetFile file -a V

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.