Category Archives: dev

How to use your iPhone hot spot over USB with Ubuntu Linux

So I use my iPhone hotspot all the time. I used to simply set the hotspot over wifi.

But I learned how to get the hotspot to work over USB, possibly making it a bit faster, yeah? Since the data goes over cable not via wifi between phone and computer.

I use Ubuntu Linux.

  1. Make sure USB is disconnected between phone and computer.
  2. Make sure Personal Hotspot is off in phone.
  3. Plug in phone via usb to computer
  4. You should be prompted to ‘Trust’ the computer- do that, go ahead and select Trust the connection.
  5. Enable hotspot on the phone
  6. Now, under network management- where you select what connection you want, you should have a ‘wired connection’ option. Select that (it may auto connect also).
  7. Should soon read Networking Interface Connected to Wired Connection 1/2/etc.

using tar creating archive recursively

I wanted to quickly make a tar file of a set of directories and copy them to another box.

tar cvf – $(find . ) > out.tar

Now, if you have lsutils

tar cvf – `find `lsd“ > out.tar

the to expand
tar xvf out.tar

Manually installing fonts
On ubuntu-
after putting the new fonts somewhere in /usr/share/fonts/
run this command:
fc-cache -v -f

Liste to da radio


Radio is a pretty mysterious and wonderful thing.

I”ve heard some beautiful things on the radio- I”ve been introduced to
beautiful things- such as the Magnetic Fields, the Wrens..

There are these .. Indie stations.. That is.. college music radio.

There are two kinds of radio stations that I personally find precious.
Indie music, and npr.


Npr”s sort of a network of stations all accross the country- funded by
listeners like you and me. No advertisements.
You can hear David Sedaris reading his latest work of “fiction”, the lastest
world news- etc. Incredible stuff. Cooking shows.. Why people are happy or
sad. Yup- that ecclectic.


I can think of a couple close to my heart.. Emmerson in Boston, and Princeton.
These stations have shows that are run by the latest most cutting edge
musicians in the world.
We all know how music becomes a revolution- at first some people get together
and play in your mom”s basement. Then they play at a friend”s house- then the
“band” gets a few members and moves to London or NY. Before David Jones was
David Bowie- wouldn”t it be cool to know such good stuff before it became
Now now.. I”ve heard a lot of bullshit about this.
I saw this site where people had posted complaints about the fact that
“Modest Mouse” was now commonplace. They were complaining that cheerleaders
and “jocks” were listening to that music- that it sucks.

What the fuck.
How fucking dare you? Really?
That”s like … Complaining that many people like choccolate and are able to
get a hold of it.
What a fucking jackass lowlife.

Get some balls- because this has got to be a case of intellectual insecurity.
Really? You need to be one of the few people who know and enjoy this piece
of culture?
That”s about the most selfish and disgusting things I”ve had the pleasure
and certainty to judge.

Why do you need to have things that are your own?
Why do you need to separate people?
Oh, I fucking get it. I do.
But it”s teenage shit- get over it.

Yes, this kinda shit is deep and intricate, and “they” don”t get it- The
Smiths, My Bloody Valentine, Joy Division, the Velvet Underground- yes.
So what”s the fucking problem?

playing streaming mp3 stream

WPRB 103.3FM
princeton nj
princeton radio
indie music mp3 stream real player
# windows media playlist

boston ma
emerson radio
indie music windows media mp3 shoutcast

WAMU 88.5FM / has npr
american university radio

does not work:
does not work:

narnia is racist and christian

Even the dragon protecting the treasure midway in the movie is white, it has blue human like eyes.
The minotaur, you can see one of them looking up, it’s got black hair, but the snout and skin around the eyes is *white*.

Following the lue star in the sky wreaks of the baby jesus story.

There is a lion that appears in people’s dreams and then in real life and then dissapears. It refers to the main characters as ‘my son’. Really.

My conclussion is that this movie wad made to pollute the minds of children with neocon nazzi propaganda.

finding and downloading movies from nntp

This is a short tutorial on finding and downloading movies from newsgroups.

People find media via various means, some choices are/have been; napster, limewire, and now the popular torrents. A little more obscure is what I use, nntp, newsgroups. This is also referred to as usenet and newgroup binaries.

You will need a paid subscription to newgroup access, and a news reader.

  1. I get access via supernews.
  2. My newsreader of choice is pan.

You have two choices for searching for movies. You can download a list of all post headers from the newsgroup alt.binaries.movies.divx .. Or.. You can do what I have stumbled on lately..

  1. Do a search for a movie title via the binsearch service, which rawks.
  2. Select with a check the collection you want, likely a 800+ meg one.
  3. Select to save .nzb file. This is a text file describing where the posting files reside.
  4. Open pan, select File -> Import NZB Files. Let the dowload proceed.

Ok, now you have a bunch of rar and par2 files… So what do we do with that?
Par2 files are so that if you have partial downloads, you can repair missing chunks and missing files.
The command is par2, from the par2cmdline project, you may be able to simply install this on ubuntu with the command;

apt-get install par2cmdline

A common command to check and possibly repair an archive you just downloaded is;

par2 r main-archive-parfilename.par2

And then you will have to extract your archive;

unrar x main-archive-rarfilename.rar

You will need the unrar utility. You can search on ubuntu/debian via; (as root);

apt-cache search unrar

Hope that helps.

facebook review pros and cons

I think I may have an interesting take on the system.
I am a developer- but also I am an artist.
I”ve been using facebook for a few months now.
I use fb to keep in touch with friends- and to help organize and promote my arts organization.

I am a member of gone studio, a small group of people in the creative arts scene.
We make heavy use of fb. We depend on it to promote and present our rock shows and art openings to the world.

Fb does have drawbacks, as I am realizing.

There are discourses on why fb is bad for you, in regards to privacy. I don”t care about my privacy very much here- most of what they want is to sell me things. I don”t mind.
There *are* other things that concern me, that is what I am hoping to highlight here.

I don”t know very much about this, I am going to collect information about this.

Places arguing about fb privacy issues. This is not hard to find;

Now, I am much more interested in non-privacy issues.

My #1 concern; Facebook is a closed network.

What do I mean casino online by that?
That you need a login to access the information. Any information that any db members display.
That means that all information you put into fb, stays in fb. It cannot be accessed by casual web surfers. Also, it cannot be accessed by external software, especially not without the use of a browser. That pretty much shoots it up for my intents- scripting.

I do not want to demand that my web audience have a fb login to access my fb information.
That”s impossible. Because FB wants to make it so everybody needs a login to access that info.

By contrast, look at google calendars. You do need an a google account to manage a calendar.
But you do not need a google account to see someone else”s calendar.

Right now, my small group depends on fb to organize and coordinate events.
If we used google calendars, we can simply display that information to all- as we do.
What if I wanted to list all events posted on fb on our site? That cannot be done.
What if I wanted to show people a gallery of pictures of one of our events- show the pictures posted on fb to other people? Unless they are logged into fb- they cannot see the content. I could build a script to break into fb and mine data- but this is not supported by their “api”, and furthermore it is a violation of their terms of service. ( This is where I must brag that when I”ve scraped (i tend to call it reaping), I use random and timed calls- just because I don”t want to be detected. I”d rather let my scrape take an hour insteda of fifteen seconds. It”s still better than five weeks by human hands. By the way, I don”t scrape anymore. )

This is the danger of depending on facebook to do anything else but keep in touch with your friends.

brightening images with image magick

p>I took a ton of pictures at a show, and then I had a lot of these that were way too dark. I try not to use a flash when I shoot a band- because it”s annoying- and it simply doesn”t look as interesting.

My pics were too dark, I don”t want to go one by one and make them brighter in the gimp. So..
In comes imagemagick, using casino online mogrify (which changes images in place, erasing the original) or convert (makes changes to a copy of the file, leaving original intact).

What we are interested in here is the -modulate flag.

Here”s a quick example, this uses mogrify- so it changes the pictures in place, erasing originals;

$ mogrify -modulate 190,80 -contrast images*jpg

Modulate takes three commad-delimited arguments, each is a percentage. The first argument is brightness, then saturation, then hue.
So if you want your image twice as bright and half as saturated you would run this command:

$ mogrify -modulate 200,50 image1.jpg

Yes, this is cpu intensive. Yes, this is a million light years ahead of editing by hand.
Yes, this erases originals.. so… let”s make a backup before we do the crazy..

mkdir /tmp/backup_images
cp ./*.??? /tmp/backup_images/
mogrify -modulate 190,80,90 ./*.???


Similar to keeping your nails clean and bare or with clear polish
Isabel Marant SneakerDressing the Family for the Holidays

how to remove hard coded subtitles from movie

$ mplayer  FlashGordon1980.avi -vf delogo=40:235:450:50:1

This mplayer video filter (-vf) will blur a section of the screen. The first two numbers are the x and y coordinates for where to start the rectangle (the horizontonal, and vertical coordinates within the screen). The next two numbers are the width and height, the last number is the blur at the edge of the stated rectangle.

What I noticed at first is that it was hard to find where I was placing the rectangle when I started playing the movie. You should start by placing the box at the top, and moving it around, and use a -1 for the last value.. So.. to *start* … run this command..

$ mplayer  FlashGordon1980.avi -vf delogo=10:10:400:50:-1

This places a blurry rectangle accross your screen with a green border. Move it around by changing the first two values. When you know where you want it, make the last value be a positive integer.. such as..

$ mplayer  FlashGordon1980.avi -vf delogo=40:235:450:50:1

To see more.. try ‘man mplayer’ and search for \delogo..

              Suppresses  a  TV  station  logo  by a simple interpolation of the surrounding pixels.  
              Just set a rectangle covering the logo and watch it disappear (and sometimes
              something even uglier appear - your mileage may vary).
                      top left corner of the logo
                      width and height of the cleared rectangle
                 t   Thickness of the fuzzy edge of the rectangle (added to w and h).  
                     When set to -1, a green rectangle is drawn on the screen to  simplify  finding  the  right
                     x,y,w,h parameters.


the Ted Bundy Killer WhaleThe Place
chanel espadrilles8 Scale Nitro Race Car With Pistol Grip Remote Control 220

fixing mp3 id3 tags in unix

I was browsing through my music collection and found a soundtrack to Natural Born Killers.
I thought, great- I’ll put this in my ipod.

The ipod organizes by album, track, and artist.
I put these files in, but the track names, album, etc – were all messed up!!!
It seems they were encoded in Japanese or Chinese- most likely.

So- what to do?
As a human being, visually, I had all the data I needed.
But what would I do, tag each one separately? Fix the id3 tags by hand?
Hell no, that’s why I run unix- not to so stupid shit like that.

So, I solved it. Here’s how.

(You’ll need id3tag command, it’s in libid3tag package )

My file listing:

$ ls
01 - Leonard Cohen - Waiting For The Miracle.mp3
02 - L7 - Shitlist.mp3
03 - Dan Zanes - Moon Over Greene County.mp3
04 - Patti Smith - Rock & Roll Nigger.mp3
05 - Cowboy Junkies - Sweet Jane.mp3
06 - Bob Dylan - You Belong To Me.mp3
07 - Duane Eddy - The Trembler.mp3
08 - Nine Inch Nails - Burn.mp3
09 - Brian Berdan - Route 666.mp3
10 - Remmy Ongala - Totally Hot.mp3
11 - Patsy Cline - Back In Baby's Arms.mp3
12 - Peter Gabriel - Taboo.mp3
13 - Jane's Addiction - Sex Is Violent.mp3
14 - AOS - History (Repeats Itself).mp3
15 - Nine Inch Nails - Something I Can Never Have.mp3
16 - Russell Means - I Will Take You Home.mp3
17 - Hollywood Persuaders - Drums A Go-Go.mp3
18 - Barry Adamson - Hungry Ants.mp3
19 - Dr.Dre - The Day The Niggaz Took Over.mp3
20 - Juliette Lewis - Born Bad.mp3
21 - Sergio Cervetti - Fall Of The Rebel Angels.mp3
22 - Lard - Forkboy.mp3
23 - Budapest Philharmonic - Batonga In Batongaville.mp3
24 - Nine Inch Nails - A Warm Place.mp3
25 - Khan & Nusrat Fateh - Allah, Mohammed, Char, Yaar.mp3
26 - Leonard Cohen - The Future.mp3
27 - Dogg Pound - What Would U Do.mp3

I know the album is ‘Natural Born Killers’. I can tell the id3 tag info I need from the filenames. I need to format this to fit id3tag commands such as:

idt3tag --artist='Peter Gabriel' --album='Natural Born Killers' --track=12 --song='Taboo' '12 - Peter Gabriel - Taboo.mp3'
  1. Create a dsv

    What I’m going to do is create a delimiter separated values file (dsv) for short.

    We know that each ‘field’ is separated here by ‘ – ‘, we cannot set the delimiter to be more than one character at a time (this is not perl, this is bash- so we need to make the field delimiter be one character. Let’s use the colon (as do password files).

    for file in *mp3 ; do record=$(echo $file | sed 's/ - /:/g' | sed 's/\.mp3//') ; echo "$record:$file" >> data ; done

    Great, let’s check out the data…

    $ cat data
    01:Leonard Cohen:Waiting For The Miracle:01 - Leonard Cohen - Waiting For The Miracle.mp3
    02:L7:Shitlist:02 - L7 - Shitlist.mp3
    03:Dan Zanes:Moon Over Greene County:03 - Dan Zanes - Moon Over Greene County.mp3
    04:Patti Smith:Rock & Roll Nigger:04 - Patti Smith - Rock & Roll Nigger.mp3
    05:Cowboy Junkies:Sweet Jane:05 - Cowboy Junkies - Sweet Jane.mp3
    06:Bob Dylan:You Belong To Me:06 - Bob Dylan - You Belong To Me.mp3
    07:Duane Eddy:The Trembler:07 - Duane Eddy - The Trembler.mp3
    08:Nine Inch Nails:Burn:08 - Nine Inch Nails - Burn.mp3
    09:Brian Berdan:Route 666:09 - Brian Berdan - Route 666.mp3
    10:Remmy Ongala:Totally Hot:10 - Remmy Ongala - Totally Hot.mp3
    11:Patsy Cline:Back In Baby's Arms:11 - Patsy Cline - Back In Baby's Arms.mp3
    12:Peter Gabriel:Taboo:12 - Peter Gabriel - Taboo.mp3
    13:Jane's Addiction:Sex Is Violent:13 - Jane's Addiction - Sex Is Violent.mp3
    14:AOS:History (Repeats Itself):14 - AOS - History (Repeats Itself).mp3
    15:Nine Inch Nails:Something I Can Never Have:15 - Nine Inch Nails - Something I Can Never Have.mp3
    16:Russell Means:I Will Take You Home:16 - Russell Means - I Will Take You Home.mp3
    17:Hollywood Persuaders:Drums A Go-Go:17 - Hollywood Persuaders - Drums A Go-Go.mp3
    18:Barry Adamson:Hungry Ants:18 - Barry Adamson - Hungry Ants.mp3
    19:Dr.Dre:The Day The Niggaz Took Over:19 - Dr.Dre - The Day The Niggaz Took Over.mp3
    20:Juliette Lewis:Born Bad:20 - Juliette Lewis - Born Bad.mp3
    21:Sergio Cervetti:Fall Of The Rebel Angels:21 - Sergio Cervetti - Fall Of The Rebel Angels.mp3
    22:Lard:Forkboy:22 - Lard - Forkboy.mp3
    23:Budapest Philharmonic:Batonga In Batongaville:23 - Budapest Philharmonic - Batonga In Batongaville.mp3
    24:Nine Inch Nails:A Warm Place:24 - Nine Inch Nails - A Warm Place.mp3
    25:Khan & Nusrat Fateh:Allah, Mohammed, Char, Yaar:25 - Khan & Nusrat Fateh - Allah, Mohammed, Char, Yaar.mp3
    26:Leonard Cohen:The Future:26 - Leonard Cohen - The Future.mp3
    27:Dogg Pound:What Would U Do:27 - Dogg Pound - What Would U Do.mp3

    Looks good? Yes? No? Edit and make changes to your data file as wanted.

  2. Create the id3tag commands

    Now we’re going to use unix ‘read’ to create out commands..

    $ IFS=':'; cat data | while read track artist song file; do echo id3tag --artist=\'$artist\' --song=\'$song\' --track=$track --album=\'Natural Born Killers\' \'$file\'; done > commands

    Notice that we set IFS to colon.
    Let’s revise our commands..

    $ cat commands
    id3tag --artist='Leonard Cohen' --song='Waiting For The Miracle' --track=01 --album='Natural Born Killers' '01 - Leonard Cohen - Waiting For The Miracle.mp3'
    id3tag --artist='L7' --song='Shitlist' --track=02 --album='Natural Born Killers' '02 - L7 - Shitlist.mp3'
    id3tag --artist='Dan Zanes' --song='Moon Over Greene County' --track=03 --album='Natural Born Killers' '03 - Dan Zanes - Moon Over Greene County.mp3'
    id3tag --artist='Patti Smith' --song='Rock & Roll Nigger' --track=04 --album='Natural Born Killers' '04 - Patti Smith - Rock & Roll Nigger.mp3'
    id3tag --artist='Cowboy Junkies' --song='Sweet Jane' --track=05 --album='Natural Born Killers' '05 - Cowboy Junkies - Sweet Jane.mp3'
    id3tag --artist='Bob Dylan' --song='You Belong To Me' --track=06 --album='Natural Born Killers' '06 - Bob Dylan - You Belong To Me.mp3'
    id3tag --artist='Duane Eddy' --song='The Trembler' --track=07 --album='Natural Born Killers' '07 - Duane Eddy - The Trembler.mp3'
    id3tag --artist='Nine Inch Nails' --song='Burn' --track=08 --album='Natural Born Killers' '08 - Nine Inch Nails - Burn.mp3'
    id3tag --artist='Brian Berdan' --song='Route 666' --track=09 --album='Natural Born Killers' '09 - Brian Berdan - Route 666.mp3'
    id3tag --artist='Remmy Ongala' --song='Totally Hot' --track=10 --album='Natural Born Killers' '10 - Remmy Ongala - Totally Hot.mp3'
    id3tag --artist='Patsy Cline' --song='Back In Baby's Arms' --track=11 --album='Natural Born Killers' '11 - Patsy Cline - Back In Baby's Arms.mp3'
    id3tag --artist='Peter Gabriel' --song='Taboo' --track=12 --album='Natural Born Killers' '12 - Peter Gabriel - Taboo.mp3'
    id3tag --artist='Jane's Addiction' --song='Sex Is Violent' --track=13 --album='Natural Born Killers' '13 - Jane's Addiction - Sex Is Violent.mp3'
    id3tag --artist='AOS' --song='History (Repeats Itself)' --track=14 --album='Natural Born Killers' '14 - AOS - History (Repeats Itself).mp3'
    id3tag --artist='Nine Inch Nails' --song='Something I Can Never Have' --track=15 --album='Natural Born Killers' '15 - Nine Inch Nails - Something I Can Never Have.mp3'
    id3tag --artist='Russell Means' --song='I Will Take You Home' --track=16 --album='Natural Born Killers' '16 - Russell Means - I Will Take You Home.mp3'
    id3tag --artist='Hollywood Persuaders' --song='Drums A Go-Go' --track=17 --album='Natural Born Killers' '17 - Hollywood Persuaders - Drums A Go-Go.mp3'
    id3tag --artist='Barry Adamson' --song='Hungry Ants' --track=18 --album='Natural Born Killers' '18 - Barry Adamson - Hungry Ants.mp3'
    id3tag --artist='Dr.Dre' --song='The Day The Niggaz Took Over' --track=19 --album='Natural Born Killers' '19 - Dr.Dre - The Day The Niggaz Took Over.mp3'
    id3tag --artist='Juliette Lewis' --song='Born Bad' --track=20 --album='Natural Born Killers' '20 - Juliette Lewis - Born Bad.mp3'
    id3tag --artist='Sergio Cervetti' --song='Fall Of The Rebel Angels' --track=21 --album='Natural Born Killers' '21 - Sergio Cervetti - Fall Of The Rebel Angels.mp3'
    id3tag --artist='Lard' --song='Forkboy' --track=22 --album='Natural Born Killers' '22 - Lard - Forkboy.mp3'
    id3tag --artist='Budapest Philharmonic' --song='Batonga In Batongaville' --track=23 --album='Natural Born Killers' '23 - Budapest Philharmonic - Batonga In Batongaville.mp3'
    id3tag --artist='Nine Inch Nails' --song='A Warm Place' --track=24 --album='Natural Born Killers' '24 - Nine Inch Nails - A Warm Place.mp3'
    id3tag --artist='Khan & Nusrat Fateh' --song='Allah, Mohammed, Char, Yaar' --track=25 --album='Natural Born Killers' '25 - Khan & Nusrat Fateh - Allah, Mohammed, Char, Yaar.mp3'
    id3tag --artist='Leonard Cohen' --song='The Future' --track=26 --album='Natural Born Killers' '26 - Leonard Cohen - The Future.mp3'
    id3tag --artist='Dogg Pound' --song='What Would U Do' --track=27 --album='Natural Born Killers' '27 - Dogg Pound - What Would U Do.mp3'

    Look good? Revise, edit at will..

  3. Do it

    Now we run the commands..

    sh commands


Unix rules.

newbie picking away at awk

I’ve been looking into awk off and on.
This is kind of a weird thing to do, coming from perl.
I’m not a perl genius, but, I’m intermediate. Which is saying a lot.
Perl is a beast. It’s a madman in the forest tripping on lsd- who commands power over small countries and speaks to aliens. If you can talk to perl, it can do everything from giving your wife an orgasm to putting the baby to sleep.

So, awk- it would seem silly to be interested in it. Since perl could do all of this already. Why learn it?

Well, I’ve been learning it. Because if there’s anything cooler than perl, it’s unix.
And awk is .. well.. unixy.

So.. awk. I’m a total awk noob, please.. keep in mind.

Awk seems to be cool for parsing line output, for one.
I often do ls -lha for listing sizes of things. And I may not ne interested in, you know.. permissions. Because maybe I just want to know the size of things..

Playing with ls output

Regular ls

$ ls -lh
total 76K
-rw-rw-r-- 1 leo leo 3.9K 2010-07-13 08:17
-rw-rw-r-- 1 leo leo 138 2010-07-02 03:27
-rw-r--r-- 1 leo leo 4.1K 2010-07-08 12:31 htaccess
-rw-r--r-- 1 leo leo 3.7K 2010-07-08 12:31 htaccess2
-rw-r--r-- 1 leo leo 3.5K 2010-07-08 12:30 htaccess3
-rw-r--r-- 1 leo leo 4.0K 2010-07-08 12:35 htaccess4
drwxrwxr-x 2 leo leo 4.0K 2010-07-13 08:18 meta-refresh-versions
-rw-rw-r-- 1 leo leo 5.0K 2010-07-02 02:44 old-new.urls
-rw-r--r-- 1 leo leo 20K 2010-07-13 08:18
-rw-rw-r-- 1 leo leo 6.0K 2010-07-02 02:27
-rw-rw-r-- 1 leo leo 5.0K 2010-07-02 02:43 sitemap.old

Yes, but what would jesus awk say?

$ ls -lh | awk '{ printf "s %s\n", $5, $8 }'

 4.1K htaccess
 3.7K htaccess2
 3.5K htaccess3
 4.0K htaccess4
 4.0K meta-refresh-versions
 5.0K old-new.urls
 5.0K sitemap.old

Get it? No?
The lines are treated one by one. Each argument is $1, $2, $3, etc.
The delimiter is by default, the shell delimiter. That’s capricorn weekly horoscope sign should climb upwards because financial security is necessary for this sign. whitespace (tab space).

looking for text in files and editing in vim

I often need to find something in code or text. Maybe I’m messing with wordpress stuff, and need to find a php function.

For example, finding a php function..

I want to look for a function called get_author* in the php files around here..

html $ find ~/public_html/ -name "*php" | xargs grep 'function get_author'
/home/leocharre/public_html/wp-includes/link-template.php:function get_author_feed_link( $author_id, $feed = '' ) {
/home/leocharre/public_html/wp-includes/rewrite.php: function get_author_permastruct() {
/home/leocharre/public_html/wp-includes/author-template.php:function get_author_posts_url($author_id, $author_nicename = '') {
/home/leocharre/public_html/wp-includes/theme.php:function get_author_template() {

Yes, but what would awk say?

Automating this somewhat..
The cool thing would be to automatically go there, or at least prit the commands so I can call up vim by cut and paste.

Ok.. not the easiest thing as it turns out… making use of this..

html $ find ~/public_html/ -name "*php" | xargs grep -s 'function get_author' | sed 's/:\s\ /:/' | sed "s/'.\ //" | grep2vim
vim '/home/leocharre/public_html/wp-includes/link-template.php' /'function get_author_feed_link( $author_id, $feed = '
vim '/home/leocharre/public_html/wp-includes/rewrite.php' /'function get_author_permastruct() {'
vim '/home/leocharre/public_html/wp-includes/author-template.php' /'function get_author_posts_url($author_id, $author_nicename = '
vim '/home/leocharre/public_html/wp-includes/theme.php' /'function get_author_template() {'

Where grep2vim is an awk script inside my bin dir..

html $ cat ~/bin/grep2vim
#!/bin/awk -f
BEGIN { FS=":" }
{ printf "vim '%s' /'%s'\n", $1, $2 }


The output is pretty cool, it’s cut and paste, for example.. and then vim gets the commnand to search for that string, that’s what the / fuss is all about.

Okkkaaaaay…. Putting it all together..

html $ cat ~/bin/findphpfunction2vim

if [ -z "$BASEDIR" ]; then
 echo "$0 missing DIR path"
 exit 1

if [ -z "$FUNCTIONNAME" ]; then
 echo "$0 missing function name"
 exit 1

find $BASEDIR -name "*.php" | xargs grep -s "function $FUNCTIONNAME" | sed 's/:\s\ /:/' | sed "s/'.\ //" | grep2vim

Example usage:

html $ findphpfunction2vim ./ is_user
vim './wp-includes/ms-functions.php' /'function is_user_member_of_blog( $user_id, $blog_id = 0 ) {'
vim './wp-includes/ms-functions.php' /'function is_user_spammy( $username = 0 ) {'
vim './wp-includes/ms-functions.php' /'function is_user_option_local( $key, $user_id = 0, $blog_id = 0 ) {'
vim './wp-includes/pluggable.php' /'function is_user_logged_in() {'
vim './wp-admin/includes/class-wp-importer.php' /'function is_user_over_quota() {'

Great, using my terminal emulator, I can just double click and middle click to cut and paste, automatically executed since select works including the carriage return.