Archive for the ‘Uncategorized’ Category

So I’ve been using virtual machines much more frequently recently, but only new VM’s that I’ve created. This weekend was my first attempt at P2V (physical to virtual). I have a decent XP dual core machine that has served me well for the last 2 years, but after my upgrade to a nice I7 Win7 [...]

I recently needed to modify hundreds of links on a wiki page based on a dynamic value, so I created a simple bookmarklet (ModWikiLinks).
I searched for a tool to properly format/shrink it and found: the bookmarklet crunchinator.

var user = prompt(‘Enter your username’);
var links = document.querySelectorAll(‘a[href*=localhost]‘);
for (i in links) {
if (typeof links[i].href !== "undefined") {
[...]

pcregrep

In: Uncategorized

3 Dec 2009

I recently learned about pcregrep, a enhanced grep that supports perl regex syntax. This is great for searches that span multiple line. For example, the other day I was looking thru old css files that had a border set to 0 to be removed due to the inclusion of a reset.css lib. So ….

pcregrep –color [...]

More one liners

In: Uncategorized

31 Oct 2009

Back with more one liners…
This one converts all html tags in a file to lowercase.
perl -pi.old -e ’s/(<\/?)(address|applet|area|a|base|basefont|big|blockquote|body|br|b|caption|center|cite|code|dd|dfn|dir|div|dl|dt|em|font|form|h1|h2|h3|h4|h5|h6|head|hr|html|img|input|isindex|i|kbd|link|li|map|menu|meta|ol|option|param|pre|p|samp|script|select|small|strike|strong|style|sub|sup|table|td|textarea|th|title|tr|tt|ul|u|var)([\s\/>])/$1.lc($2).$3/gie’ file
This concatenates all files of a specified type – prefixed with its title. Useful for quick code review across many files.

for i in $(find -regex ".*\.jsp$"); do echo ‘<!–’ $i ‘–>’; cat $i; done > combined.jsp

This one [...]

I always preferred accessing assets from the web root like this <img src=”/images” /> or in my css as url(/images). Simple, consistent.
However, when forced to delve a little deeper, I had to make some additional distinctions.
First, “/” starts at the web root (obviously), but what’s the root if the page is accessed by the filesystem [...]