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

Introducing my new personal website

Posted by Jorge Bernal May 22, 2008

Jorge Bernal logo

Yes, you read it right, website. I know that sounds like 90s, and today trends are blogs and social networks, but I felt I needed some semi-static place to hold some info about who I am.

It’s not finished yet, I have more ideas for it, but it’s been sitting in my hard drive in a decent state for a while, and I think it’s time to obey the release early, release often motto.

Go there, if you want: www.jorgebernal.info

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

Some bash aliases to speed up daily tasks

Posted by Jorge Bernal May 20, 2008

# Enable some colors
alias ls="ls -G"
# Gimme details and size in KB, MB or GB, I'm not good reading bytes
alias l="ls -lh"

# SSH aliases
alias moe="ssh moe.warp.es"
# I always misspelled that one :P
alias mow=moe
alias ebox="ssh root@ebox"
alias amedias="ssh amedias.org"
alias rssh="ssh -l root"

# Git alias
ci="git ci" # Formerly svn ci
# Jump to github from repository
alias github=”git config -l | grep ‘remote.origin.url’ | sed -n \
’s/remote.origin.url=git@github.com:\(.*\)\/\(.*\).git/https:\/\/github.com\/\1\/\2/p’ \
| xargs open”

# MySQL
alias myserver=”sudo /usr/local/mysql/support-files/mysql.server”

# Start webserver on localhost:8000 sharing current directory
alias webshare=’python -c “import SimpleHTTPServer;SimpleHTTPServer.test()”‘

# Rails server
alias ss=”./script/server”
alias sss=”screen ./script/server”
alias sr=”screen -r”
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