diff --git a/aliases b/aliases index 27ca6fe..7bb4311 100644 --- a/aliases +++ b/aliases @@ -96,8 +96,9 @@ make_vid_dir_and_cd_into() { # Download YouTube videos dl_youtube_vid() { local format="$1" - local url="$2" - shift 2 + local shortname="$2" + local url="$3" + shift 3 local opts="$@" if [[ $url == "" ]]; then @@ -112,7 +113,13 @@ dl_youtube_vid() { return fi - local filename=$(youtube-dl.exe --get-filename -o "%(upload_date)s-%(title)s-youtube-%(id)s.%(ext)s" $url) + if [[ $shortname -eq 0 ]]; then + local name_format="%(upload_date)s-%(title)s-youtube-%(id)s" + else + local name_format="%(upload_date)s-shortname-youtube-%(id)s" + fi + + local filename=$(youtube-dl.exe --get-filename -o "$name_format.%(ext)s" $url) filename="${filename:0:4}-${filename:4:2}-${filename:6}" if [[ $format == "" ]]; then @@ -354,26 +361,7 @@ git_nuke() { #################################################################################################### - -alias ls='ls --color' -alias l='ls -lh' -alias ll='ls -lha' - -# Handle the fact that this file will be used with multiple OSs -if [[ $platform == 'Linux' ]]; then - # Arch - alias flux='redshift' - alias ipconfig='ip addr' - alias ifconfig='ip addr' - alias pi='yaourt -S' # wrapper around Arch Pacman - alias po='pacman -Qdt' # see orphaned packages - alias pr='yaourt -R' # giving me trouble now - alias prr='pacman -Rdd' - alias pss='sudo pacman -Syu' - alias pu='yaourt -U' - # TODO add a trash alias for trash-cli? - -elif [[ $platform == 'Darwin' ]]; then +if [[ $platform == 'Darwin' ]]; then alias trash='rmtrash' alias tt='rmtrash' @@ -397,6 +385,10 @@ alias cd...='cd ../..' alias cd....='cd ../../..' alias cd.....='cd ../../../..' +alias ls='ls -F --color' +alias l='ls -lh' +alias ll='ls -lha' + alias aliases='vim ~/.dotfiles/aliases' alias al='aliases' @@ -459,7 +451,6 @@ alias code='cd ~/code' alias cpr='cp -r' alias dc='gdc' alias dot='cd ~/.dotfiles' -alias pdot='cd ~/.private-dotfiles' alias duh='du -csh' alias exp='explorer .' alias f='fg' @@ -471,7 +462,7 @@ alias lcc='lein clean' alias lca='lein cljsbuild auto dev' alias ldi='lein deps install' alias lsd='lein start-dev' -alias moon='curl wttr.in/moon' +alias moon='curl wttr.in/moon -A "curl"' alias patch='git format-patch HEAD^ --stdout > patch.diff' alias reguard='killall -9 ruby ; guard' alias rb='rbenv' @@ -491,18 +482,21 @@ alias stk='rlwrap stk-simply' alias t='tree' alias tag='ctags -R .' alias tmp='cd ~/tmp' -alias u='cd ..' alias v='vim' alias vi='vim' alias vh='vagrant halt' alias vs='vagrant ssh' alias vu='vagrant up' alias vimrc='vim ~/.vimrc' -alias weather='curl wttr.in/toronto' +alias weather='curl wttr.in/toronto -A "curl"' + +alias yt='dl_youtube_vid "" 0' +alias yt-shortname='dl_youtube_vid "" 1' +alias yt-1080='dl_youtube_vid "137+140" 0' +alias yt-1080-shortname='dl_youtube_vid "137+140" 1' +alias yt-720='dl_youtube_vid "136+140" 0' +alias yt-720-shortname='dl_youtube_vid "136+140" 1' -alias yt='dl_youtube_vid ""' -alias yt-1080='dl_youtube_vid "137+140"' -alias yt-720='dl_youtube_vid "136+140"' alias yt-playlist='dl_youtube_playlist ""' alias yt-playlist-1080='dl_youtube_playlist "137+140"' alias yt-playlist-720='dl_youtube_playlist "136+140"' @@ -562,8 +556,10 @@ alias gap='git add -Ap' alias gau='git add --update' alias gaup='git add --update -p' alias gb='git branch -v' +alias gbb='git bisect bad' alias gbd='git branch -D' alias gbdr='git branch -Dr' +alias gbg='git bisect good' alias gbl='git branch --all' alias gblm='git blame -wMC' alias gbm='git branch -m' @@ -679,8 +675,5 @@ alias gwip="git add . && git commit -m \"WIP\"" alias flow='haxelib run flow' alias snowfall='haxelib run snowfall' -# Other aliases -alias pal='vim ~/.private-dotfiles/aliases' -test -f ~/.private-dotfiles/aliases && . ~/.private-dotfiles/aliases - alias cmake-gen='cmake -D CMAKE_CXX_COMPILER="/Library/Developer/CommandLineTools/usr/bin/c++" CMAKE_C_COMPILER="/Library/Developer/CommandLineTools/usr/bin/cc" ..' + diff --git a/bash/bashrc b/bash/bashrc index 5b2756c..bd165cc 100644 --- a/bash/bashrc +++ b/bash/bashrc @@ -9,7 +9,8 @@ esac # Unbreak broken, non-colored terminal export TERM=xterm-256color -test -f ~/.env.common && . ~/.env.common +# Load the shell environment. +test -f ~/.env.loader && . ~/.env.loader # TMP and TEMP are defined in the Windows environment. Leaving them set to the default # Windows temporary directory can have unexpected consequences. @@ -101,3 +102,4 @@ if ! shopt -oq posix; then . /etc/bash_completion fi fi + diff --git a/env.common b/env.loader similarity index 71% rename from env.common rename to env.loader index 283edfa..0329e86 100644 --- a/env.common +++ b/env.loader @@ -13,11 +13,11 @@ esac export PLATFORM=$platform export PLATFORM_OS=$platform_os -test -f $HOME/.env.platform && . $HOME/.env.platform -test -f $HOME/.private-dotfiles.common/env && . $HOME/.private-dotfiles.common/env -test -f $HOME/.private-dotfiles/env && . $HOME/.private-dotfiles/env - -test -f $HOME/.aliases && . $HOME/.aliases +test -f $HOME/.env.platform && . $HOME/.env.platform +test -f $HOME/.env.common && . $HOME/.env.common +test -f $HOME/.env.private && . $HOME/.env.private +test -f $HOME/.aliases && . $HOME/.aliases +test -f $HOME/.aliases.common && . $HOME/.aliases.common test -f $HOME/.aliases.private && . $HOME/.aliases.private if [[ -d "$HOME/bin" ]]; then diff --git a/install b/install index 78cc401..b9a612f 100755 --- a/install +++ b/install @@ -87,14 +87,27 @@ pushd "$HOME" &>/dev/null setup_dir $cwd .dotfiles if [[ $is_windows -eq 1 ]]; then - printf "${MAGENTA}==> ${NORMAL}Copy ${YELLOW}.dotfiles/vim${NORMAL} to ${YELLOW}$PWD/.vim${NORMAL}\n" - cp -r .dotfiles/vim .vim + do_vim_copy=1 + if [[ -d "$PWD/.vim" ]]; then + printf "\n${BOLD}Vim folder already found at destination. Overwrite? [1,0]\n> ${NORMAL}" + read -e copy_vim + if [[ $copy_vim != "0" && $copy_vim != "1" ]]; then + fatal "Invalid value '$copy_vim'" + elif [[ $copy_vim == "0" ]]; then + do_vim_copy=0 + printf "\n" + fi + fi + if [[ $do_vim_copy -eq 1 ]]; then + printf "${MAGENTA}==> ${NORMAL}Copying ${YELLOW}.dotfiles/vim${NORMAL} to ${YELLOW}$PWD/.vim${NORMAL}\n" + cp -r .dotfiles/vim .vim + fi else setup_dir .dotfiles/vim .vim fi FILES=() -FILES+=('env.common') +FILES+=('env.loader') FILES+=('aliases') FILES+=('gitconfig') FILES+=('vimrc') @@ -106,8 +119,8 @@ do done set +e -git_comp_filename=".git-completions.bash" -printf "${MAGENTA}==> ${NORMAL}Download git completions list to ${YELLOW}$PWD/$git_comp_filename${NORMAL}\n" +git_comp_filename=".git-completion.bash" +printf "${MAGENTA}==> ${NORMAL}Downloading Git completion list to ${YELLOW}$PWD/$git_comp_filename${NORMAL}\n" curl https://raw.githubusercontent.com/git/git/master/contrib/completion/git-completion.bash -o $git_comp_filename set -e diff --git a/script_helpers/file_ops.sh b/script_helpers/file_ops.sh index c63866b..2d00570 100644 --- a/script_helpers/file_ops.sh +++ b/script_helpers/file_ops.sh @@ -140,6 +140,7 @@ link_file() { dest_path=$2 require_confirmation=$3 expand_symlinks=$4 + debug=0 os_is_windows is_windows os_is_unix is_unix @@ -152,7 +153,6 @@ link_file() { source_has_space=$(path_has_a_space "$source_path") dest_has_space=$(path_has_a_space "$dest_path") - debug=0 if [[ $debug -eq 1 ]]; then echo source path: $source_path echo dest path: $dest_path @@ -187,15 +187,15 @@ link_file() { test -e "$dest_path" && error "Dest file '$dest_path' already exists!\n" && return if [[ $is_windows -eq 1 ]]; then - source_path=$(unix_to_windows_path "$source_path") - dest_path=$(unix_to_windows_path "$dest_path") - if [[ $source_has_space -eq 1 ]]; then source_path="\"$source_path\""; fi - if [[ $dest_has_space -eq 1 ]]; then dest_path="\"$dest_path\""; fi - link_cmd="cmd //c 'mklink $dest_path $source_path'" + cmd_source_path=$(unix_to_windows_path "$source_path") + cmd_dest_path=$(unix_to_windows_path "$dest_path") + if [[ $source_has_space -eq 1 ]]; then cmd_source_path="\"$cmd_source_path\""; fi + if [[ $dest_has_space -eq 1 ]]; then cmd_dest_path="\"$cmd_dest_path\""; fi + link_cmd="cmd //c 'mklink $cmd_dest_path $cmd_source_path'" else - if [[ $source_has_space -eq 1 ]]; then source_path="\"$source_path\""; fi - if [[ $dest_has_space -eq 1 ]]; then dest_path="\"$dest_path\""; fi - link_cmd="ln -sf $source_path $dest_path" + if [[ $source_has_space -eq 1 ]]; then cmd_source_path="\"$cmd_source_path\""; fi + if [[ $dest_has_space -eq 1 ]]; then cmd_dest_path="\"$cmd_dest_path\""; fi + link_cmd="ln -sf $cmd_source_path $cmd_dest_path" fi if [[ $require_confirmation -eq 1 ]]; then @@ -206,8 +206,8 @@ link_file() { fi if [[ $debug -eq 1 ]]; then - echo Final source: $source_path - echo Final dest: $dest_path + echo Final cmd source: $cmd_source_path + echo Final cmd dest: $cmd_dest_path echo Link cmd:: $link_cmd fi diff --git a/windows/readme.md b/windows/readme.md index 2ece176..5c02707 100644 --- a/windows/readme.md +++ b/windows/readme.md @@ -203,8 +203,8 @@ processor time and is generally useless. * Install Android platform tools to get adb.exe: * Download [Android commandline tools](https://developer.android.com/studio/#downloads) - * Unzip to some location. - * Inside the sdk dir, run `$ tools/bin/sdkmanager.bat platform-tools`. + * Unzip and place the contents into the folders `cmdline-tools/tools/` + * Run the sdkmanager.bat script to install the tools: `$ ./cmdline-tools/tools/bin/sdkmanager.bat "platform-tools"` * You can now add the platform-tools dir to your path if you want, or just symlink `adb` to `~/bin`. ### Youtube-DL