Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/zsh
- # To use: source <thisfile>
- alias url='open -a "Google Chrome"'
- function urlencode_old () {
- if [[ ${#@} -eq 0 ]]
- then
- echo $(python -c "from urllib.request import quote;import sys; print(quote('\n'.join(sys.stdin.readlines())))")
- else
- echo $(python -c "from urllib.request import quote;print(quote('''${*}'''))")
- fi
- }
- function urlencode() {
- local c reply
- for c in ${(s::)@}; do
- [[ $c == [a-zA-Z0-9/_.~] ]] || printf -v c '%%%02X' $(( #c ))
- reply+=$c
- done
- echo "${reply}"
- }
- alias g='google'
- alias goog='google'
- alias so='stackoverflow'
- # Begin generated results here
- alias go/helpin='url "http://go/helpin"'
- alias go/questions='url "http://go/questions"'
- alias go/wiki='url "http://go/wiki"'
- alias gmail='url "https://mail.google.com"'
- alias epochconverter='url "https://www.epochconverter.com"'
- alias jsfiddle='url "https://jsfiddle.net"'
- alias regex101='url "https://regex101.com"'
- alias urlencoder='url "https://meyerweb.com/eric/tools/dencoder"'
- alias keycodes='url "https://keycode.info"'
- alias keycodechart='url "http://www.foreui.com/articles/Key_Code_Table.htm"'
- function amazon() { if [[ $[#] -eq 0 ]]; then url "https://www.amazon.com";else;url "https://www.amazon.com/s?url=search-alias%3Daps&field-keywords=$(urlencode "${@}")";fi }
- function google() { if [[ $[#] -eq 0 ]]; then url "https://www.google.com";else;url "https://www.google.com/search?q=$(urlencode "${@}")";fi }
- function google_img() { if [[ $[#] -eq 0 ]]; then url "https://www.google.com";else;url "https://www.google.com/search?q=$(urlencode "${@}")&tbm=isch";fi }
- function httpcat() { if [[ $[#] -eq 0 ]]; then url "https://http.cat/";else;url "https://http.cat/$(urlencode "${@}")";fi }
- function colorhex() { if [[ $[#] -eq 0 ]]; then url "https://www.color-hex.com";else;url "https://www.color-hex.com/color/$(urlencode "${@}")";fi }
- function macapp() { if [[ $[#] -eq 0 ]]; then url "http://macappstore.org/";else;url "http://macappstore.org/$(urlencode "${@}")/";fi }
- function nasdaq() { if [[ $[#] -eq 0 ]]; then url "https://www.nasdaq.com";else;url "https://www.nasdaq.com/symbol/$(urlencode "${@}")/real-time";fi }
- function rfc() { if [[ $[#] -eq 0 ]]; then url "https://tools.ietf.org";else;url "https://tools.ietf.org/html/$(urlencode "${@}")";fi }
- function stackoverflow() { if [[ $[#] -eq 0 ]]; then url "https://stackoverflow.com";else;url "https://stackoverflow.com/search?q=$(urlencode "${@}")";fi }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement