Koke’s

My English alter-ego

More aliases: Firefox keywords

Posted by Jorge Bernal May 22, 2008

I keep on with my productivity little tricks. This time I’m sharing some of my firefox shortcuts. I’m not in the mood for explaining how to actually install these, so check out the excellent article Firefox and the art of keyword bookmarking, if you need help.

# Dictionary search
dict http://dictionary.reference.com/search?q=%s

# Yahoo finance stock
fi http://finance.yahoo.com/q?s=%s

# Wikipedia page
wp http://en.wikipedia.org/wiki/Special:Search?search=%s
slang http://www.urbandictionary.com/define.php?term=%s

# Search in MySQL website/manual
my http://mysql.com/%s

# BitTorrent search
bt http://www.yotoshi.com/?keyword=%s
code http://www.google.com/codesearch?q=%s

# Ruby documentation
ri http://www.google.es/search?hl=es&client=firefox-a&rls=org.mozilla%3Aes-ES%3Aofficial&hs=3zt&q=%s+site%3Aruby-doc.org&btnI=B%C3%BAsqueda&meta=

# Google search (experimental version with keyboard shortcuts)
g http://www.google.com/search?q=%s&esrch=BetaShortcuts

# Google search (I'm feeling lucky)
gg http://www.google.com/search?q=%s&esrch=BetaShortcuts&btnI=Lucky

# eBay search
ebay http://search.ebay.es/search/search.dll?satitle=%s

# Post current page in delicious
pkd javascript:location.href='http://del.icio.us/koke?v=3&url='+encodeURIComponent(location.href)+'&title='+encodeURIComponent(document.title)

# My delicious (with tag support)
kd http://del.icio.us/koke/%s
as https://www.google.com/adsense/report/overview
gr http://www.google.com/reader/view/
fb http://www.feedburner.com/fb/a/myfeeds
ga https://www.google.com/analytics/home/

By the way, I haven’t typed all these urls. In your firefox user dir (~/.firefox or ~/.mozilla), there should be a places.sqlite file.

Some sqlite love actually helps :)

sqlite> SELECT k.keyword, p.url FROM
	moz_bookmarks b
	JOIN moz_places p ON p.id = b.fk
	JOIN moz_keywords k ON k.id = b.keyword_id
	WHERE b.keyword_id IS NOT NULL;

AddThis Social Bookmark Button   AddThis Feed Button

Flickr commentr

Posted by Jorge Bernal May 21, 2008

Update: I forgot to mention, the source code for the server part is available at flickr-commentr

flickr commentr is a simple tool to allow you post flickr pictures on flickr comments, or any other forum or blog

To install it, drag this bookmarlet to your bookmarks bar

flickr comment

When you are browsing a flickr photo, click the bookmarklet and you’ll see a popup like the following screenshot, where you can select the size and attributes to show, and copy the HTML code to post the picture.

AddThis Social Bookmark Button   AddThis Feed Button

Introducing wordpress-scripts 0.1 (0.2 out)

Posted by Jorge Bernal May 13, 2008

Update: I’ve been suffering some ungly and stupid bugs today, so I’ve fixed them and released version 0.2. It also includes a new script wp-update-home.

I love Wordpress
I’ve just published some scripts that help me manage my personal wordpress installations, and publish some plugins I’m working on.

Warning: these are early versions which I use for small tasks. If you find
a bug or have suggestions, contact me at jbernal@warp.es

Download version 0.1 version 0.2 or browse the wordpress-scripts git repository.

wp-dump

wp-dump helps you to backup your wordpress database. Just tell where is the wordpress directory and where to put the dump file

Syntax

$ wp-dump wordpress-dir outfile

outfile will be a gzipped SQL dump, so you should use the .sql.gz extension

wp-import

wp-import helps you to restore your wordpress database. Just tell where is the wordpress directory and where to read the backup file

wp-import expects the backup to be a gzipped dump

Syntax

$ wp-import wordpress-dir infile

publish.sh

publish.sh is useful if you:

  • Manage your plugins with git
  • Want to publish versions to a remote server using scp
Syntax

$ publish.sh plugin_name version

publish.sh will replace version numbers in your code (see Requirements), tag
the release with git, create a tarball and upload it to the specified server.

Requirements

First, you need a config file called ~/.wpplugins. An sample way to do this is

$ echo myserver.example.com:public_html/plugins/ > ~/.wpplugins

where myserver.example.com is your server and public_html/plugins/ is the
path (relative from your $HOME) to upload the tarballs

publish.sh can also replace version numbers in your plugin. It will detect these two cases

  • Plugin header: Version 0.1
  • Version constant: define(plugin_name_version, ‘0.1’);

wp-update-home

When you are syncing wordpress databases, one of the fundamental things to change is the siteurl and home options with the remote URL.

Syntax

$ wp-update-home wordpress-dir myhost.example.com

It’s been a while since I last released some open source project (beyond small patches) and it feels as good as ever :)

AddThis Social Bookmark Button   AddThis Feed Button

Function of the day: rgrep

Posted by Jorge Bernal May 08, 2008

Updated: I’ve added some –exclude options to ignore svn and git directories. Also be sure to check out the comments, there are pretty nice variations there.

Add this to your ~/.bashrc

rgrep () { grep -rin --exclude=\*.svn\* --exclude=\*.git\* "$*" . }

And you get a handy grep replacement

$ rgrep function wp_head ./general-template.php:785:function wp_head() {
AddThis Social Bookmark Button   AddThis Feed Button

Mercurial is great for personal projects

Posted by Jorge Bernal April 15, 2008

First, I hope this doesn’t become a flamewar about version control, it’s just what I’ve found useful.

Sometimes I feel the need to be able to go back in time when doing small changes. I don’t want to set up an external repository, creating branches or anything like that: just plain file revision control.

Whenever I feel that need I do:

$ hg init
$ hg add
$ hg commit -m "Initial import"

And I’m ready to go

The only thing I have to care about is the .hgignore file, to skip logs, cache files and so on.

If I don’t need version control anymore, I just have to remove the .hg directory and everything is like it was before.

By the way, I’m working on my new personal site: stay tuned for more!

AddThis Social Bookmark Button   AddThis Feed Button

I love to hack my phone

Posted by Jorge Bernal April 03, 2008

koke@warhol:~/tmp$ sqlite3 sms.db
SQLite version 3.4.0
Enter ".help" for instructions
sqlite> select rowid,date,text from message where rowid = 2;
2|1206801673|arr. Habemus iPhone
sqlite>
AddThis Social Bookmark Button   AddThis Feed Button

Make your e-mail conversations better using happy faces

Posted by Jorge Bernal November 25, 2007

I’m sure every one who uses email frequently, has suffered more than one email discussion.

Usually you may say things in an email that you wouldn’t say in person, or reply furious about something before counting to ten. This screenshot shows my little trick:

happy-mail.jpg

I’m using Apple Mail with Addressbook, but most of email programs support adding pictures to your contacts.

Find a picture of every of your colleagues, or people you write most and assign it to their contact info.

Make sure he or she is smiling, or with a lovely face, or even use a picture that reminds you of the best moments you have spent with that person.

Next time you are furious with that person (no matter what the cause is) you’ll see that picture and it might help you calm down and think in positive. It works quite well for me.

AddThis Social Bookmark Button   AddThis Feed Button

Giving hints to the user

Posted by Jorge Bernal August 07, 2007

Backpack hint

I just had to share this screenshot. This is what happens when you create a new page in Backpack. The arrow disappears once you do your first edit.

AddThis Social Bookmark Button   AddThis Feed Button

My top 10 commands

Posted by Jorge Bernal June 11, 2007

It seems I’m a ruby guy after all:

$ history | awk '{print $2}' | awk 'BEGIN {FS="|"} {print $1}'|sort|uniq -c | sort -rn | head -10
111 svn
61 cd
44 rake
36 l
32 hg
18 ./script/console
14 rm
12 screen
12 history
12 ./script/server

AddThis Social Bookmark Button   AddThis Feed Button