Some fixes and setup changes

This commit is contained in:
Michael Campagnaro 2020-09-29 21:51:11 -04:00
parent ccd0cf5e6c
commit 61d309008e
6 changed files with 66 additions and 58 deletions

61
aliases
View File

@ -96,8 +96,9 @@ make_vid_dir_and_cd_into() {
# Download YouTube videos # Download YouTube videos
dl_youtube_vid() { dl_youtube_vid() {
local format="$1" local format="$1"
local url="$2" local shortname="$2"
shift 2 local url="$3"
shift 3
local opts="$@" local opts="$@"
if [[ $url == "" ]]; then if [[ $url == "" ]]; then
@ -112,7 +113,13 @@ dl_youtube_vid() {
return return
fi 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}" filename="${filename:0:4}-${filename:4:2}-${filename:6}"
if [[ $format == "" ]]; then if [[ $format == "" ]]; then
@ -354,26 +361,7 @@ git_nuke() {
#################################################################################################### ####################################################################################################
if [[ $platform == 'Darwin' ]]; then
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
alias trash='rmtrash' alias trash='rmtrash'
alias tt='rmtrash' alias tt='rmtrash'
@ -397,6 +385,10 @@ alias cd...='cd ../..'
alias cd....='cd ../../..' 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 aliases='vim ~/.dotfiles/aliases'
alias al='aliases' alias al='aliases'
@ -459,7 +451,6 @@ alias code='cd ~/code'
alias cpr='cp -r' alias cpr='cp -r'
alias dc='gdc' alias dc='gdc'
alias dot='cd ~/.dotfiles' alias dot='cd ~/.dotfiles'
alias pdot='cd ~/.private-dotfiles'
alias duh='du -csh' alias duh='du -csh'
alias exp='explorer .' alias exp='explorer .'
alias f='fg' alias f='fg'
@ -471,7 +462,7 @@ alias lcc='lein clean'
alias lca='lein cljsbuild auto dev' alias lca='lein cljsbuild auto dev'
alias ldi='lein deps install' alias ldi='lein deps install'
alias lsd='lein start-dev' 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 patch='git format-patch HEAD^ --stdout > patch.diff'
alias reguard='killall -9 ruby ; guard' alias reguard='killall -9 ruby ; guard'
alias rb='rbenv' alias rb='rbenv'
@ -491,18 +482,21 @@ alias stk='rlwrap stk-simply'
alias t='tree' alias t='tree'
alias tag='ctags -R .' alias tag='ctags -R .'
alias tmp='cd ~/tmp' alias tmp='cd ~/tmp'
alias u='cd ..'
alias v='vim' alias v='vim'
alias vi='vim' alias vi='vim'
alias vh='vagrant halt' alias vh='vagrant halt'
alias vs='vagrant ssh' alias vs='vagrant ssh'
alias vu='vagrant up' alias vu='vagrant up'
alias vimrc='vim ~/.vimrc' 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='dl_youtube_playlist ""'
alias yt-playlist-1080='dl_youtube_playlist "137+140"' alias yt-playlist-1080='dl_youtube_playlist "137+140"'
alias yt-playlist-720='dl_youtube_playlist "136+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 gau='git add --update'
alias gaup='git add --update -p' alias gaup='git add --update -p'
alias gb='git branch -v' alias gb='git branch -v'
alias gbb='git bisect bad'
alias gbd='git branch -D' alias gbd='git branch -D'
alias gbdr='git branch -Dr' alias gbdr='git branch -Dr'
alias gbg='git bisect good'
alias gbl='git branch --all' alias gbl='git branch --all'
alias gblm='git blame -wMC' alias gblm='git blame -wMC'
alias gbm='git branch -m' alias gbm='git branch -m'
@ -679,8 +675,5 @@ alias gwip="git add . && git commit -m \"WIP\""
alias flow='haxelib run flow' alias flow='haxelib run flow'
alias snowfall='haxelib run snowfall' 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" ..' alias cmake-gen='cmake -D CMAKE_CXX_COMPILER="/Library/Developer/CommandLineTools/usr/bin/c++" CMAKE_C_COMPILER="/Library/Developer/CommandLineTools/usr/bin/cc" ..'

View File

@ -9,7 +9,8 @@ esac
# Unbreak broken, non-colored terminal # Unbreak broken, non-colored terminal
export TERM=xterm-256color 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 # TMP and TEMP are defined in the Windows environment. Leaving them set to the default
# Windows temporary directory can have unexpected consequences. # Windows temporary directory can have unexpected consequences.
@ -101,3 +102,4 @@ if ! shopt -oq posix; then
. /etc/bash_completion . /etc/bash_completion
fi fi
fi fi

View File

@ -13,11 +13,11 @@ esac
export PLATFORM=$platform export PLATFORM=$platform
export PLATFORM_OS=$platform_os export PLATFORM_OS=$platform_os
test -f $HOME/.env.platform && . $HOME/.env.platform test -f $HOME/.env.platform && . $HOME/.env.platform
test -f $HOME/.private-dotfiles.common/env && . $HOME/.private-dotfiles.common/env test -f $HOME/.env.common && . $HOME/.env.common
test -f $HOME/.private-dotfiles/env && . $HOME/.private-dotfiles/env test -f $HOME/.env.private && . $HOME/.env.private
test -f $HOME/.aliases && . $HOME/.aliases
test -f $HOME/.aliases && . $HOME/.aliases test -f $HOME/.aliases.common && . $HOME/.aliases.common
test -f $HOME/.aliases.private && . $HOME/.aliases.private test -f $HOME/.aliases.private && . $HOME/.aliases.private
if [[ -d "$HOME/bin" ]]; then if [[ -d "$HOME/bin" ]]; then

23
install
View File

@ -87,14 +87,27 @@ pushd "$HOME" &>/dev/null
setup_dir $cwd .dotfiles setup_dir $cwd .dotfiles
if [[ $is_windows -eq 1 ]]; then if [[ $is_windows -eq 1 ]]; then
printf "${MAGENTA}==> ${NORMAL}Copy ${YELLOW}.dotfiles/vim${NORMAL} to ${YELLOW}$PWD/.vim${NORMAL}\n" do_vim_copy=1
cp -r .dotfiles/vim .vim 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 else
setup_dir .dotfiles/vim .vim setup_dir .dotfiles/vim .vim
fi fi
FILES=() FILES=()
FILES+=('env.common') FILES+=('env.loader')
FILES+=('aliases') FILES+=('aliases')
FILES+=('gitconfig') FILES+=('gitconfig')
FILES+=('vimrc') FILES+=('vimrc')
@ -106,8 +119,8 @@ do
done done
set +e set +e
git_comp_filename=".git-completions.bash" git_comp_filename=".git-completion.bash"
printf "${MAGENTA}==> ${NORMAL}Download git completions list to ${YELLOW}$PWD/$git_comp_filename${NORMAL}\n" 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 curl https://raw.githubusercontent.com/git/git/master/contrib/completion/git-completion.bash -o $git_comp_filename
set -e set -e

View File

@ -140,6 +140,7 @@ link_file() {
dest_path=$2 dest_path=$2
require_confirmation=$3 require_confirmation=$3
expand_symlinks=$4 expand_symlinks=$4
debug=0
os_is_windows is_windows os_is_windows is_windows
os_is_unix is_unix os_is_unix is_unix
@ -152,7 +153,6 @@ link_file() {
source_has_space=$(path_has_a_space "$source_path") source_has_space=$(path_has_a_space "$source_path")
dest_has_space=$(path_has_a_space "$dest_path") dest_has_space=$(path_has_a_space "$dest_path")
debug=0
if [[ $debug -eq 1 ]]; then if [[ $debug -eq 1 ]]; then
echo source path: $source_path echo source path: $source_path
echo dest path: $dest_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 test -e "$dest_path" && error "Dest file '$dest_path' already exists!\n" && return
if [[ $is_windows -eq 1 ]]; then if [[ $is_windows -eq 1 ]]; then
source_path=$(unix_to_windows_path "$source_path") cmd_source_path=$(unix_to_windows_path "$source_path")
dest_path=$(unix_to_windows_path "$dest_path") cmd_dest_path=$(unix_to_windows_path "$dest_path")
if [[ $source_has_space -eq 1 ]]; then source_path="\"$source_path\""; fi if [[ $source_has_space -eq 1 ]]; then cmd_source_path="\"$cmd_source_path\""; fi
if [[ $dest_has_space -eq 1 ]]; then dest_path="\"$dest_path\""; fi if [[ $dest_has_space -eq 1 ]]; then cmd_dest_path="\"$cmd_dest_path\""; fi
link_cmd="cmd //c 'mklink $dest_path $source_path'" link_cmd="cmd //c 'mklink $cmd_dest_path $cmd_source_path'"
else else
if [[ $source_has_space -eq 1 ]]; then source_path="\"$source_path\""; fi if [[ $source_has_space -eq 1 ]]; then cmd_source_path="\"$cmd_source_path\""; fi
if [[ $dest_has_space -eq 1 ]]; then dest_path="\"$dest_path\""; fi if [[ $dest_has_space -eq 1 ]]; then cmd_dest_path="\"$cmd_dest_path\""; fi
link_cmd="ln -sf $source_path $dest_path" link_cmd="ln -sf $cmd_source_path $cmd_dest_path"
fi fi
if [[ $require_confirmation -eq 1 ]]; then if [[ $require_confirmation -eq 1 ]]; then
@ -206,8 +206,8 @@ link_file() {
fi fi
if [[ $debug -eq 1 ]]; then if [[ $debug -eq 1 ]]; then
echo Final source: $source_path echo Final cmd source: $cmd_source_path
echo Final dest: $dest_path echo Final cmd dest: $cmd_dest_path
echo Link cmd:: $link_cmd echo Link cmd:: $link_cmd
fi fi

View File

@ -203,8 +203,8 @@ processor time and is generally useless.
* Install Android platform tools to get adb.exe: * Install Android platform tools to get adb.exe:
* Download [Android commandline tools](https://developer.android.com/studio/#downloads) * Download [Android commandline tools](https://developer.android.com/studio/#downloads)
* Unzip to some location. * Unzip and place the contents into the folders `cmdline-tools/tools/`
* Inside the sdk dir, run `$ tools/bin/sdkmanager.bat platform-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`. * You can now add the platform-tools dir to your path if you want, or just symlink `adb` to `~/bin`.
### Youtube-DL ### Youtube-DL