Home Link

Hello, my name is Brett Terpstra, and it’s nice to meet you. Elegant solutions to complex problems. Curious?

Posts Tagged ‘bash’

Jun 19
2010

Just a quick hit on this one… when hacking away at the styles of things one probably shouldn’t be hacking away at, embedding images right in the CSS is a handy trick. It’s done by Base64 encoding the image, removing line breaks from the resulting string, and using it to set the background property for the CSS rule.

It looks something like this (truncated):

[…]

The image/png changes depending on the filetype that’s encoded, becoming image/jpg or image/gif, etc…

Mar 06
2010

Just a quick change to my post on the bash function […] that I’ve been using. A small modification has greatly improved its usability: make the cancel option always be first in the menu. Just move “Cancel” before the […] bit. It’s a little odd that I didn’t do that to begin with…

fp () { #find and list processes matching a case-insensitive partial-match string ps Ao pid,comm|awk '{match($0,/[^\/]+$/); print substr($0,RSTART,RLENGTH…

Nov 17
2009

I do a lot in Terminal. Sometimes, it’s easier. Sometimes it’s faster. Sometimes I’d just rather type it out. Whatever the reason, I’ve never been able to stand looking at a boring shell prompt. Bash is my primary shell, mostly because I’ve never taken the time to learn much else. I’ll get there someday. For now, here’s my current Bash shell prompt…

I’m using the […] variable to run a few quick functions to generate the prompt. It doesn’t do anything processor-intensive, so I haven’t seen any lag caused by this one (unlike some of my previous experiments). […] is set to call a function cal

Nov 14
2009

This is a function from my OS X .bash_profile. ‘fk’ is short for Find and Kill, and it lets you do a quick search of your running processes for a case-insensitive partial match of the first parameter passed to it. It’s useful for quickly finding a process without worrying about its capitalization or full spelling, and without having to sift through (or manually grep) a long […] list.

Entries (RSS) and Comments (RSS).