My zsh config made from scratch
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

67 lines
2.1 KiB

2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
  1. # Just a funky little collection of more or less useful aliases
  2. #Various impractical jokes and tools
  3. if [ -n "$LOCALCITY" ]; then
  4. alias weatherfetch="curl -sf https://wttr.in/$LOCALCITY | head -n 7 && echo ''"
  5. fi
  6. if [ -n "$DESKTOP_SESSION" ]; then
  7. # winver is a thing, so here's linver
  8. alias linver="nohup zenity --info --text=\"Linux version: \\n$(uname -srm)\" > /dev/null"
  9. # tools to manipulate xclip easier
  10. alias paste="xclip -o -selection clipboard"
  11. alias copy="xclip -o | xclip -i -selection clipboard"
  12. fi
  13. # unless you're using vim to this day, this is what most people do
  14. alias vim="nvim"
  15. function nojail() {
  16. # specific tool for firejail to disable jailing at all
  17. PATH=`echo $PATH | sed "s/:\/usr\/local\/bin//g" | sed "s/:\/usr\/local\/sbin//g"` $@
  18. }
  19. # Set a default music path
  20. if [ -z "$MUSIC_PATH" ]; then
  21. export MUSIC_PATH="$HOME/Music/"
  22. fi
  23. # Try to be sensible about youtube-dl downloader
  24. if ! which yt-dlp > /dev/null; then
  25. if ! which youtube-dl > /dev/null; then
  26. alias yt-dlp="echo Unable to execute: youtube-dl or yt-dlp not found; false "
  27. else
  28. # No, really. Not even an ad, it just runs faster because people keep fixing the throttling issue, which youtube-dl got stuck on.
  29. alias yt-dlp="echo youtube-dl is heavily outdated, consider installing yt-dlp; youtube-dl "
  30. fi
  31. fi
  32. function ytdl() {
  33. # Download and convert to audio a youtube video
  34. if [ -z "$1" ]; then
  35. echo "USAGE: ytdl <video name or URL>"
  36. return
  37. fi
  38. mkdir -p $MUSIC_PATH/ytdl
  39. yt-dlp -x --default-search "ytsearch:" --output "$MUSIC_PATH/ytdl/%(title)s.%(ext)s" $1
  40. }
  41. function scdl() {
  42. # Download audio from soundcloud
  43. if [ -z "$1" ]; then
  44. echo "USAGE: scdl <audio name or URL>"
  45. return
  46. fi
  47. mkdir -p $MUSIC_PATH/soundclown
  48. yt-dlp -x --default-search "scsearch:" --output "$MUSIC_PATH/soundclown/%(title)s.%(ext)s" $1
  49. }
  50. function countlines() {
  51. if [ -z "$1" ]; then
  52. echo "USAGE: countlines <file extension>"
  53. return
  54. fi
  55. for file in $(find . -name \*.$1); do
  56. cat $file
  57. done | wc -l
  58. }