Advertisement
sirgatez

Untitled

Apr 3rd, 2023 (edited)
687
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 2.46 KB | Source Code | 0 0
  1. #!/bin/zsh
  2. # To use: source <thisfile>
  3.  
  4. alias url='open -a "Google Chrome"'
  5. function urlencode_old () {
  6.     if [[ ${#@} -eq 0 ]]
  7.     then
  8.         echo $(python -c "from urllib.request import quote;import sys; print(quote('\n'.join(sys.stdin.readlines())))")
  9.     else
  10.         echo $(python -c "from urllib.request import quote;print(quote('''${*}'''))")
  11.     fi
  12. }
  13.  
  14. function urlencode() {
  15.     local c reply
  16.     for c in ${(s::)@}; do
  17.         [[ $c == [a-zA-Z0-9/_.~] ]] || printf -v c '%%%02X' $(( #c ))
  18.         reply+=$c
  19.     done
  20.     echo "${reply}"
  21. }
  22.  
  23.  
  24. alias g='google'
  25. alias goog='google'
  26. alias so='stackoverflow'
  27.  
  28. # Begin generated results here
  29. alias go/helpin='url "http://go/helpin"'
  30. alias go/questions='url "http://go/questions"'
  31. alias go/wiki='url "http://go/wiki"'
  32. alias gmail='url "https://mail.google.com"'
  33. alias epochconverter='url "https://www.epochconverter.com"'
  34. alias jsfiddle='url "https://jsfiddle.net"'
  35. alias regex101='url "https://regex101.com"'
  36. alias urlencoder='url "https://meyerweb.com/eric/tools/dencoder"'
  37. alias keycodes='url "https://keycode.info"'
  38. alias keycodechart='url "http://www.foreui.com/articles/Key_Code_Table.htm"'
  39. 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 }
  40. function google() { if [[ $[#] -eq 0 ]]; then url "https://www.google.com";else;url "https://www.google.com/search?q=$(urlencode "${@}")";fi }
  41. function google_img() { if [[ $[#] -eq 0 ]]; then url "https://www.google.com";else;url "https://www.google.com/search?q=$(urlencode "${@}")&tbm=isch";fi }
  42. function httpcat() { if [[ $[#] -eq 0 ]]; then url "https://http.cat/";else;url "https://http.cat/$(urlencode "${@}")";fi }
  43. function colorhex() { if [[ $[#] -eq 0 ]]; then url "https://www.color-hex.com";else;url "https://www.color-hex.com/color/$(urlencode "${@}")";fi }
  44. function macapp() { if [[ $[#] -eq 0 ]]; then url "http://macappstore.org/";else;url "http://macappstore.org/$(urlencode "${@}")/";fi }
  45. function nasdaq() { if [[ $[#] -eq 0 ]]; then url "https://www.nasdaq.com";else;url "https://www.nasdaq.com/symbol/$(urlencode "${@}")/real-time";fi }
  46. function rfc() { if [[ $[#] -eq 0 ]]; then url "https://tools.ietf.org";else;url "https://tools.ietf.org/html/$(urlencode "${@}")";fi }
  47. 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