Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.

12 anni fa
12 anni fa
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. #!/bin/sh
  2. mkdir -p ~/.my/log
  3. mkdir -p ~/.local/bin
  4. _iswindows(){
  5. case `uname` in
  6. (CYGWIN*) return 0;;
  7. (MINGW*) return 0;;
  8. esac
  9. return 1
  10. }
  11. gen_source_script(){
  12. # _gen_source_script file lines
  13. test $# -eq 2 || return 1
  14. head -n $2 $1 | \grep -v '^#!' | sed -e 's/^..//g'
  15. }
  16. get_install_script(){
  17. local dir="$HOME/.local/bin"
  18. mkdir -p "$dir"
  19. for f in "$@"
  20. do
  21. bn=$(basename "$f")
  22. type $bn >/dev/null 2>&1 || {
  23. if type wget >/dev/null 2>&1
  24. then
  25. wget "$f" -P "$dir/" &&
  26. chmod u+x "${dir}/${bn}"
  27. elif type curl >/dev/null 2>&1
  28. then
  29. curl --url "$f" --output "${dir}/${bn}" &&
  30. chmod u+x "${dir}/${bn}"
  31. fi
  32. }
  33. done
  34. }
  35. install_symlink_script(){
  36. mkdir -p "$HOME/.local/bin/"
  37. for f in "$@"
  38. do
  39. ln -s "$PWD/$f" "$HOME/.local/bin/"
  40. done
  41. }
  42. git_config(){
  43. type git >/dev/null 2>&1 || return 1
  44. git config --global user.name '10sr'
  45. git config --global user.email '8slashes+git@gmail.com'
  46. git config --global core.autocrlf false
  47. git config --global core.excludesfile '~/.gitignore'
  48. git config --global color.ui auto
  49. git config --global status.relativePaths false
  50. git config --global status.showUntrackedFiles normal
  51. git config --global log.date iso
  52. git config --global alias.graph "log --graph --date-order -C -M --pretty=tformat:\"%C(green)%h%C(reset) %C(white)%ad%C(reset) %C(red)%an%C(reset)%C(yellow)%d%C(reset) %C(white bold)%s%C(reset)\" --all --date=iso -n 499"
  53. git config --global alias.st "status -s -b"
  54. git config --global alias.b "branch"
  55. git config --global alias.sb "show-branch"
  56. git config --global alias.ci "commit --verbose"
  57. git config --global alias.co "checkout"
  58. git config --global alias.cim "commit --verbose -m"
  59. git config --global alias.di "diff --color"
  60. git config --global alias.me "merge --no-ff --stat -v"
  61. # git config --global alias.ls "ls-files -v --full-name"
  62. git config --global alias.ls "status -u -s ."
  63. git config --global alias.sl "!sl"
  64. # git config --global alias.my-ls "ls-files | xargs ls"
  65. # git config --global alias.ll "!git ls-files | xargs ls -l -CFG --color=auto --time-style=long-iso"
  66. git config --global alias.addi "add -i"
  67. git config --global alias.clean-p "!test -z \"\$(git status -s -uno)\""
  68. git config --global alias.wc "!git ls-files -z | xargs -0 wc"
  69. # git config --global push.default "simple"
  70. if _iswindows; then
  71. git config --global core.fileMode false
  72. fi
  73. }
  74. mac_defaults(){
  75. test "`uname`" = Darwin || return 1
  76. # http://appdrill.net/60641/mac-boot-mute.html
  77. #sudo nvram SystemAudioVolume=%80
  78. # add quit entry in menu
  79. defaults write com.apple.finder QuitMenuItem -bool YES
  80. # show full path on titlebar
  81. defaults write com.apple.finder _FXShowPosixPathInTitle -bool YES
  82. # do not show desktop icons
  83. defaults write com.apple.finder CreateDesktop -boolean false
  84. killall Finder
  85. # disable dashboard
  86. #defaults write com.apple.dashboard mcx-disabled -bool YES
  87. }
  88. mac_start_daemon(){
  89. test "`uname`" = Darwin || return 1
  90. test "`launchctl getenv LC_ALL`" = C || sudo launchctl setenv LC_ALL C
  91. if ! (launchctl list | grep com.apple.locate)
  92. then
  93. sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.locate.plist
  94. fi
  95. }
  96. get_install_script http://www.frexx.de/xterm-256-notes/data/colortable16.sh \
  97. http://www.frexx.de/xterm-256-notes/data/256colors2.pl
  98. git_config
  99. mac_defaults
  100. mac_start_daemon