Skip to content

Instantly share code, notes, and snippets.

@dcunited001
Created February 17, 2013 21:55
Show Gist options
  • Save dcunited001/4973707 to your computer and use it in GitHub Desktop.
Save dcunited001/4973707 to your computer and use it in GitHub Desktop.
#===============================
# Search Google
#===============================
# using perl for brevity, for pure bash function:
# http://stackoverflow.com/questions/296536/urlencode-from-a-bash-script
uriescape() { echo $_ | perl -MURI::Escape -lne 'print uri_escape($_)'; }
# site-wide codewall search via google
ggljoin() { echo "$*" | sed s/\ /+/g }
# $1 is the site, the rest is the query
# returns the parameter needed to pass to google.com/search?q=
gglsitequery() {
site=`uriescape site:$1`; shift;
echo `ggljoin $site $@[@]`
}
# `open` is mac-only; use `xdg-open` on ubuntu
ggl() { query=`ggljoin "$*"`; open "https://google.com/search?q=$query"; }
gglsite() { query=`gglsitequery $*`; open "https://google.com/search?q=$query" }
#===============================
# Search Coderwall
#===============================
# search by trending tags:
cwall() { open https://coderwall.com/p/t/$1 }
# search coderwall by site-wide google search:
cwallsite() { gglsite "coderwall.com" $@[@] }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment