Skip to content

Instantly share code, notes, and snippets.

@XayOn
Last active January 4, 2016 01:49
Show Gist options
  • Save XayOn/8550978 to your computer and use it in GitHub Desktop.
Save XayOn/8550978 to your computer and use it in GitHub Desktop.
Some searcher functions in bash with wget and some regex magic.
google(){ export ua="Mozilla/5.0 (Linux; U; Android 0.5; en-us) AppleWebKit/522+ (KHTML, like Gecko) Safari/419.3"; ( for i in $(seq 0 $2); do wget -O - --user-agent="$ua" "https://www.google.es/search?safe=off&output=search&sclient=psy-ab&q=$1&start=$((i * 10 ))"; done ) 2>/dev/null | grep -o '<a href=['"'"'"][^"'"'"']*['"'"'"]' | sed -e 's/^<a href=["'"'"']//' -e 's/["'"'"']$//'|egrep -v "^/|^#|google|javascript:void";}
github(){ google "site:github.com $1" 1|egrep '^https://github.com/[[:alnum:]]{0,40}/[-[:alnum:]]{0,40}$'; }
google_feelinglucky(){ google ${@} |head -n1; }
github_feelinglucky(){ github ${@} |head -n1; }
# git clone $(github_feelinglucky nanobenv);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment