mac.sh 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. ##############################################################################
  2. #
  3. # Mac OS X Commands
  4. #
  5. ##############################################################################
  6. alias cb='pbcopy'
  7. alias wireshark='sudo /Applications/Wireshark.app/Contents/MacOS/Wireshark'
  8. if file_exists "/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl"; then
  9. function subl() {
  10. /Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl ${1:-.}
  11. }
  12. fi;
  13. if file_exists "/Users/ramatevish/projects/llama.cpp/main"; then
  14. function llama() {
  15. (cd /Users/ramatevish/projects/llama.cpp; ./main --color -i -ins -n 512 -p "You are a helpful AI who will assist, provide information, answer questions, and have conversations." -m ggml-alpaca-7b-native-q4-migrated.bin)
  16. }
  17. fi;
  18. # Record audio files
  19. if command_exists sox; then
  20. alias record="sox -d ${1:-out.mp3}"
  21. fi
  22. # Only enable if Kaleidoscope is installed
  23. if grep Kaleidoscope ~/.gitconfig > /dev/null 2>&1; then
  24. alias gm='git mergetool -y -t Kaleidoscope';
  25. fi
  26. if command_exists uuidgen; then
  27. alias uuidgen="uuidgen | awk '{print tolower($1)}'"
  28. fi
  29. function rmdstore() {
  30. find . -name '.DS_Store' -type f -delete
  31. }
  32. if command_exists ykman; then
  33. function 2fac () {
  34. DEV_ID="${2:-5421671}"
  35. if defined $1; then
  36. ykman --device $DEV_ID oath code $1 | tee /dev/tty | awk '{ print $2 }' | pbcopy
  37. else
  38. ykman --device $DEV_ID oath code
  39. fi
  40. }
  41. function 2facs() {
  42. watch -n1 -d ykman oath code
  43. }
  44. fi
  45. function unfuck-core-audio {
  46. ps aux | grep coreaudio | grep -v grep | awk '{ print $2 }' | sudo xargs kill -9
  47. }
  48. function unfuck-windows {
  49. killall -KILL Dock
  50. }
  51. function ls-usb {
  52. ioreg -p IOUSB -w0 | sed 's/[^o]*o //; s/@.*$//' | grep -v '^Root.*'
  53. }
  54. function pwinfo {
  55. # ioreg -w 0 -f -r -c AppleSmartBattery
  56. system_profiler SPPowerDataType
  57. }