Various things (aliases, vimrc, scripts, readme)
This commit is contained in:
		
							parent
							
								
									5f60495990
								
							
						
					
					
						commit
						dfc7e9ec74
					
				
							
								
								
									
										249
									
								
								aliases
									
									
									
									
									
								
							
							
						
						
									
										249
									
								
								aliases
									
									
									
									
									
								
							| 
						 | 
					@ -134,6 +134,7 @@ make_vid_dir_and_cd_into() {
 | 
				
			||||||
        # @note If the filename contains symbols that are incompatible with
 | 
					        # @note If the filename contains symbols that are incompatible with
 | 
				
			||||||
        # Windows' directory names then add --restrict-filenames to the command.
 | 
					        # Windows' directory names then add --restrict-filenames to the command.
 | 
				
			||||||
        dir_name=$(youtube-dl.exe --get-filename -o "%(upload_date)s - %(title)s" $opts $url)
 | 
					        dir_name=$(youtube-dl.exe --get-filename -o "%(upload_date)s - %(title)s" $opts $url)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if [[ $dir_name == "" ]]; then
 | 
					        if [[ $dir_name == "" ]]; then
 | 
				
			||||||
            return 1
 | 
					            return 1
 | 
				
			||||||
        fi
 | 
					        fi
 | 
				
			||||||
| 
						 | 
					@ -157,21 +158,24 @@ make_vid_dir_and_cd_into() {
 | 
				
			||||||
dl_youtube_vid() {
 | 
					dl_youtube_vid() {
 | 
				
			||||||
    local format="$1"
 | 
					    local format="$1"
 | 
				
			||||||
    local shortname="$2"
 | 
					    local shortname="$2"
 | 
				
			||||||
    local url="$3"
 | 
					    local make_folder="$3"
 | 
				
			||||||
    shift 3
 | 
					    local url="$4"
 | 
				
			||||||
 | 
					    shift 4
 | 
				
			||||||
    local opts="$@"
 | 
					    local opts="$@"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if [[ $url == "" ]]; then
 | 
					    if [[ $url == "" ]]; then
 | 
				
			||||||
        error "Format: $0 <url> <optional args>\n"
 | 
					        error "Format: $0 <make folder?> <url> <optional args>\n"
 | 
				
			||||||
        return
 | 
					        return
 | 
				
			||||||
    fi
 | 
					    fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    opts+=" --write-sub --sub-lang en --embed-subs"
 | 
					    opts+=" --write-sub --sub-lang en --embed-subs"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    make_vid_dir_and_cd_into $url
 | 
					    if [[ $make_folder == "1" ]]; then
 | 
				
			||||||
 | 
					        make_vid_dir_and_cd_into $url ""
 | 
				
			||||||
        if [[ $? -ne 0 ]]; then
 | 
					        if [[ $? -ne 0 ]]; then
 | 
				
			||||||
            return
 | 
					            return
 | 
				
			||||||
        fi
 | 
					        fi
 | 
				
			||||||
 | 
					    fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if [[ $shortname -eq 0 ]]; then
 | 
					    if [[ $shortname -eq 0 ]]; then
 | 
				
			||||||
        local name_format="%(upload_date)s-%(title)s-youtube-%(id)s"
 | 
					        local name_format="%(upload_date)s-%(title)s-youtube-%(id)s"
 | 
				
			||||||
| 
						 | 
					@ -188,27 +192,32 @@ dl_youtube_vid() {
 | 
				
			||||||
        youtube-dl.exe -f $format -o "$filename" $opts $url
 | 
					        youtube-dl.exe -f $format -o "$filename" $opts $url
 | 
				
			||||||
    fi
 | 
					    fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if [[ $make_folder == "1" ]]; then
 | 
				
			||||||
        cd ..
 | 
					        cd ..
 | 
				
			||||||
 | 
					    fi
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Download YouTube video and flip horizontally.
 | 
					# Download YouTube video and flip horizontally.
 | 
				
			||||||
dl_youtube_vid_and_hflip() {
 | 
					dl_youtube_vid_and_hflip() {
 | 
				
			||||||
    local format="$1"
 | 
					    local format="$1"
 | 
				
			||||||
    local url="$2"
 | 
					    local make_folder="$2"
 | 
				
			||||||
    shift 2
 | 
					    local url="$3"
 | 
				
			||||||
 | 
					    shift 3
 | 
				
			||||||
    local opts="$@"
 | 
					    local opts="$@"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if [[ $url == "" ]]; then
 | 
					    if [[ $url == "" ]]; then
 | 
				
			||||||
        error "Format: $0 <url> <optional args>\n"
 | 
					        error "Format: $0 <make folder?> <url> <optional args>\n"
 | 
				
			||||||
        return
 | 
					        return
 | 
				
			||||||
    fi
 | 
					    fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    opts+=" --write-sub --sub-lang en --embed-subs"
 | 
					    opts+=" --write-sub --sub-lang en --embed-subs"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    make_vid_dir_and_cd_into $url
 | 
					    if [[ $make_folder == "1" ]]; then
 | 
				
			||||||
 | 
					        make_vid_dir_and_cd_into $url ""
 | 
				
			||||||
        if [[ $? -ne 0 ]]; then
 | 
					        if [[ $? -ne 0 ]]; then
 | 
				
			||||||
            return
 | 
					            return
 | 
				
			||||||
        fi
 | 
					        fi
 | 
				
			||||||
 | 
					    fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    local filename=$(youtube-dl.exe --get-filename -o "%(upload_date)s-%(title)s-youtube-%(id)s.%(ext)s" $url)
 | 
					    local filename=$(youtube-dl.exe --get-filename -o "%(upload_date)s-%(title)s-youtube-%(id)s.%(ext)s" $url)
 | 
				
			||||||
    filename="${filename:0:4}-${filename:4:2}-${filename:6}"
 | 
					    filename="${filename:0:4}-${filename:4:2}-${filename:6}"
 | 
				
			||||||
| 
						 | 
					@ -223,7 +232,9 @@ dl_youtube_vid_and_hflip() {
 | 
				
			||||||
    ffmpeg -i "$filename" -vf hflip -c:a copy "copy_${filename}"
 | 
					    ffmpeg -i "$filename" -vf hflip -c:a copy "copy_${filename}"
 | 
				
			||||||
    mv "copy_${filename}" "$filename"
 | 
					    mv "copy_${filename}" "$filename"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if [[ $make_folder == "1" ]]; then
 | 
				
			||||||
        cd ..
 | 
					        cd ..
 | 
				
			||||||
 | 
					    fi
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
dl_youtube_playlist() {
 | 
					dl_youtube_playlist() {
 | 
				
			||||||
| 
						 | 
					@ -259,6 +270,21 @@ dl_youtube_playlist() {
 | 
				
			||||||
    cd ..
 | 
					    cd ..
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Download Twitch chat transcript
 | 
				
			||||||
 | 
					actually_dl_twitch_chat() {
 | 
				
			||||||
 | 
					    local url="$1"
 | 
				
			||||||
 | 
					    local filename="$2"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    rechat.exe -d $url "$filename.json"
 | 
				
			||||||
 | 
					    if [[ -f "$filename.json" ]]; then
 | 
				
			||||||
 | 
					        rechat.exe -p "$filename.json" "$filename.txt" -b -o
 | 
				
			||||||
 | 
					        mv "$filename.txt" "${filename:0:4}-${filename:4:2}-${filename:6}.txt"
 | 
				
			||||||
 | 
					        rm "$filename.json"
 | 
				
			||||||
 | 
					    else
 | 
				
			||||||
 | 
					        error "Video doesn't have a chat transcript."
 | 
				
			||||||
 | 
					    fi
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
dl_twitch_chat() {
 | 
					dl_twitch_chat() {
 | 
				
			||||||
    local url="$1"
 | 
					    local url="$1"
 | 
				
			||||||
    shift 1
 | 
					    shift 1
 | 
				
			||||||
| 
						 | 
					@ -274,45 +300,43 @@ dl_twitch_chat() {
 | 
				
			||||||
        return
 | 
					        return
 | 
				
			||||||
    fi
 | 
					    fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # Download Twitch chat transcript
 | 
					    actually_dl_twitch_chat $url "$(youtube-dl.exe --get-filename -o "%(upload_date)s-%(title)s-twitch-%(id)s" $opts $url)"
 | 
				
			||||||
    local name_format="%(upload_date)s-%(title)s-twitch-%(id)s"
 | 
					 | 
				
			||||||
    local chat_file=$(youtube-dl.exe --get-filename -o "$name_format" $opts $url)
 | 
					 | 
				
			||||||
    rechat.exe -d $url "$chat_file.json"
 | 
					 | 
				
			||||||
    rechat.exe -p "$chat_file.json" "$chat_file.txt" -b -o
 | 
					 | 
				
			||||||
    mv "$chat_file.txt" "${chat_file:0:4}-${chat_file:4:2}-${chat_file:6}.txt"
 | 
					 | 
				
			||||||
    rm "$chat_file.json"
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    cd ..
 | 
					    cd ..
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Download Twitch videos.
 | 
					# Download Twitch videos.
 | 
				
			||||||
# If you want to download a sub-only vid then extract your twitch cookies to a file (can use cookies.txt addon)
 | 
					# If you want to download subcriber-only vids then first extract your twitch
 | 
				
			||||||
# and then pass it as an option, using the full path to the cookies file, e.g.
 | 
					# cookies to a file (can use cookies.txt addon from Lennon Hill) and then pass it as an option,
 | 
				
			||||||
 | 
					# using the full path to the cookies file, e.g.
 | 
				
			||||||
#   `tw-1080p60 <url> --cookies /c/<cookie_path>/twitch_cookies.txt`
 | 
					#   `tw-1080p60 <url> --cookies /c/<cookie_path>/twitch_cookies.txt`
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
dl_twitch_vid() {
 | 
					dl_twitch_vid() {
 | 
				
			||||||
    local format="$1"
 | 
					    local format="$1"
 | 
				
			||||||
    local shortname="$2"
 | 
					    local shortname="$2"
 | 
				
			||||||
    local compression_level="$3"
 | 
					    local compress="$3"
 | 
				
			||||||
    local url="$4"
 | 
					    local make_folder="$4"
 | 
				
			||||||
    shift 4
 | 
					    local url="$5"
 | 
				
			||||||
 | 
					    shift 5
 | 
				
			||||||
    local opts="$@"
 | 
					    local opts="$@"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if [[ $url == "" ]]; then
 | 
					    if [[ $url == "" ]]; then
 | 
				
			||||||
        error "Format: $0 <url> <optional args>\n"
 | 
					        error "Format: $0 <make folder?> <url> <optional args>\n"
 | 
				
			||||||
        return
 | 
					        return
 | 
				
			||||||
    fi
 | 
					    fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if [[ $compression_level -eq 0 ]]; then
 | 
					    if [[ $compress -eq 0 ]]; then
 | 
				
			||||||
        printf "${BOLD}Downloading Twitch vid with no compression.${NORMAL}\n"
 | 
					        printf "${BOLD}Downloading Twitch vid with no compression.${NORMAL}\n"
 | 
				
			||||||
    else
 | 
					    else
 | 
				
			||||||
        printf "${BOLD}Downloading Twitch vid with compression level ${YELLOW}$compression_level${NORMAL}.\n"
 | 
					        printf "${BOLD}Downloading Twitch vid with compression.${NORMAL}.\n"
 | 
				
			||||||
    fi
 | 
					    fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if [[ $make_folder == "1" ]]; then
 | 
				
			||||||
        make_vid_dir_and_cd_into $url "" $opts
 | 
					        make_vid_dir_and_cd_into $url "" $opts
 | 
				
			||||||
        if [[ $? -ne 0 ]]; then
 | 
					        if [[ $? -ne 0 ]]; then
 | 
				
			||||||
            return
 | 
					            return
 | 
				
			||||||
        fi
 | 
					        fi
 | 
				
			||||||
 | 
					    fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if [[ $shortname -eq 0 ]]; then
 | 
					    if [[ $shortname -eq 0 ]]; then
 | 
				
			||||||
        local name_format="%(upload_date)s-%(title)s-twitch-%(id)s"
 | 
					        local name_format="%(upload_date)s-%(title)s-twitch-%(id)s"
 | 
				
			||||||
| 
						 | 
					@ -321,11 +345,7 @@ dl_twitch_vid() {
 | 
				
			||||||
    fi
 | 
					    fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # Download Twitch chat transcript
 | 
					    # Download Twitch chat transcript
 | 
				
			||||||
    local chat_file=$(youtube-dl.exe --get-filename -o "$name_format" $opts $url)
 | 
					    actually_dl_twitch_chat $url "$(youtube-dl.exe --get-filename -o "$name_format" $opts $url)"
 | 
				
			||||||
    rechat.exe -d $url "$chat_file.json"
 | 
					 | 
				
			||||||
    rechat.exe -p "$chat_file.json" "$chat_file.txt" -b -o
 | 
					 | 
				
			||||||
    mv "$chat_file.txt" "${chat_file:0:4}-${chat_file:4:2}-${chat_file:6}.txt"
 | 
					 | 
				
			||||||
    rm "$chat_file.json"
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # Download the video.
 | 
					    # Download the video.
 | 
				
			||||||
    local filename=$(youtube-dl.exe --get-filename -o "$name_format.%(ext)s" $opts $url)
 | 
					    local filename=$(youtube-dl.exe --get-filename -o "$name_format.%(ext)s" $opts $url)
 | 
				
			||||||
| 
						 | 
					@ -335,18 +355,82 @@ dl_twitch_vid() {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    error=$?
 | 
					    error=$?
 | 
				
			||||||
    if [[ $error -eq 0 ]]; then
 | 
					    if [[ $error -eq 0 ]]; then
 | 
				
			||||||
        if [[ $compression_level -ne 0 ]]; then
 | 
					        if [[ $compress -eq 1 ]]; then
 | 
				
			||||||
            compress-video "$filename" $compression_level "temp"
 | 
					            local temp_name="temp_${RANDOM}"
 | 
				
			||||||
 | 
					            # 1 arg = use GPU
 | 
				
			||||||
 | 
					            compress-video 1 "$filename" "$temp_name"
 | 
				
			||||||
            extension="${filename##*.}"
 | 
					            extension="${filename##*.}"
 | 
				
			||||||
            mv "$filename" uncompressed_original.$extension
 | 
					            mv "$filename" "orig_$filename.$extension"
 | 
				
			||||||
            mv temp.$extension "$filename"
 | 
					            mv $temp_name.$extension "$filename"
 | 
				
			||||||
            printf "${BOLD}Make sure to delete the original video file${NORMAL}\n"
 | 
					            printf "${BOLD}Make sure to delete the original video file${NORMAL}\n"
 | 
				
			||||||
        fi
 | 
					        fi
 | 
				
			||||||
    else
 | 
					    else
 | 
				
			||||||
        error "Error: Failed to download '$url'\n"
 | 
					        error "Error: Failed to download '$url'\n"
 | 
				
			||||||
    fi
 | 
					    fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if [[ $make_folder == "1" ]]; then
 | 
				
			||||||
        cd ..
 | 
					        cd ..
 | 
				
			||||||
 | 
					    fi
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Download Vimeo videos.
 | 
				
			||||||
 | 
					dl_vimeo_vid() {
 | 
				
			||||||
 | 
					    local format="$1"
 | 
				
			||||||
 | 
					    local shortname="$2"
 | 
				
			||||||
 | 
					    local compress="$3"
 | 
				
			||||||
 | 
					    local make_folder="$4"
 | 
				
			||||||
 | 
					    local url="$5"
 | 
				
			||||||
 | 
					    shift 5
 | 
				
			||||||
 | 
					    local opts="$@"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if [[ $url == "" ]]; then
 | 
				
			||||||
 | 
					        error "Format: $0 <make folder?> <url> <optional args>\n"
 | 
				
			||||||
 | 
					        return
 | 
				
			||||||
 | 
					    fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if [[ $compress -eq 0 ]]; then
 | 
				
			||||||
 | 
					        printf "${BOLD}Downloading Vimeo vid with no compression.${NORMAL}\n"
 | 
				
			||||||
 | 
					    else
 | 
				
			||||||
 | 
					        printf "${BOLD}Downloading Vimeo vid with compression.${NORMAL}.\n"
 | 
				
			||||||
 | 
					    fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if [[ $make_folder == "1" ]]; then
 | 
				
			||||||
 | 
					        make_vid_dir_and_cd_into $url "" $opts
 | 
				
			||||||
 | 
					        if [[ $? -ne 0 ]]; then
 | 
				
			||||||
 | 
					            return
 | 
				
			||||||
 | 
					        fi
 | 
				
			||||||
 | 
					    fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if [[ $shortname -eq 0 ]]; then
 | 
				
			||||||
 | 
					        local name_format="%(upload_date)s-%(title)s-vimeo-%(id)s"
 | 
				
			||||||
 | 
					    else
 | 
				
			||||||
 | 
					        local name_format="%(upload_date)s-shortname-vimeo-%(id)s"
 | 
				
			||||||
 | 
					    fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    # Download the video.
 | 
				
			||||||
 | 
					    local filename=$(youtube-dl.exe --get-filename -o "$name_format.%(ext)s" $opts $url)
 | 
				
			||||||
 | 
					    filename="${filename:0:4}-${filename:4:2}-${filename:6}"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    youtube-dl.exe -f "$format" -o "$filename" $opts $url
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    error=$?
 | 
				
			||||||
 | 
					    if [[ $error -eq 0 ]]; then
 | 
				
			||||||
 | 
					        if [[ $compress -eq 1 ]]; then
 | 
				
			||||||
 | 
					            local temp_name="temp_${RANDOM}"
 | 
				
			||||||
 | 
					            # 1 arg = use GPU
 | 
				
			||||||
 | 
					            compress-video 1 "$filename" "$temp_name"
 | 
				
			||||||
 | 
					            extension="${filename##*.}"
 | 
				
			||||||
 | 
					            mv "$filename" "orig_$filename.$extension"
 | 
				
			||||||
 | 
					            mv $temp_name.$extension "$filename"
 | 
				
			||||||
 | 
					            printf "${BOLD}Make sure to delete the original video file${NORMAL}\n"
 | 
				
			||||||
 | 
					        fi
 | 
				
			||||||
 | 
					    else
 | 
				
			||||||
 | 
					        error "Error: Failed to download '$url'\n"
 | 
				
			||||||
 | 
					    fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if [[ $make_folder == "1" ]]; then
 | 
				
			||||||
 | 
					        cd ..
 | 
				
			||||||
 | 
					    fi
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Download MP4 video.
 | 
					# Download MP4 video.
 | 
				
			||||||
| 
						 | 
					@ -642,12 +726,22 @@ alias vu='vagrant up'
 | 
				
			||||||
alias vimrc='vim ~/.vimrc'
 | 
					alias vimrc='vim ~/.vimrc'
 | 
				
			||||||
alias weather='curl wttr.in/toronto -A "curl"'
 | 
					alias weather='curl wttr.in/toronto -A "curl"'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
alias yt='dl_youtube_vid "" 0'
 | 
					#
 | 
				
			||||||
alias yt-shortname='dl_youtube_vid "" 1'
 | 
					# Downloading
 | 
				
			||||||
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'
 | 
					COMPRESSION_ON=1
 | 
				
			||||||
alias yt-720-shortname='dl_youtube_vid "136+140" 1'
 | 
					COMPRESSION_OFF=0
 | 
				
			||||||
 | 
					SHORTNAME_ON=1
 | 
				
			||||||
 | 
					SHORTNAME_OFF=0
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# YouTube Vid DL
 | 
				
			||||||
 | 
					alias yt='dl_youtube_vid "" $SHORTNAME_OFF'
 | 
				
			||||||
 | 
					alias yt-shortname='dl_youtube_vid "" $SHORTNAME_ON'
 | 
				
			||||||
 | 
					alias yt-1080='dl_youtube_vid "137+140" $SHORTNAME_OFF'
 | 
				
			||||||
 | 
					alias yt-1080-shortname='dl_youtube_vid "137+140" $SHORTNAME_ON'
 | 
				
			||||||
 | 
					alias yt-720='dl_youtube_vid "136+140" $SHORTNAME_OFF'
 | 
				
			||||||
 | 
					alias yt-720-shortname='dl_youtube_vid "136+140" $SHORTNAME_ON'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
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"'
 | 
				
			||||||
| 
						 | 
					@ -657,47 +751,68 @@ alias yt-audio='youtube-dl.exe -f "140"'
 | 
				
			||||||
alias yt-and-hflip='dl_youtube_vid_and_hflip "137+140"' # 1080p
 | 
					alias yt-and-hflip='dl_youtube_vid_and_hflip "137+140"' # 1080p
 | 
				
			||||||
alias ig-download-and-hflip='dl_instagram_vid_and_hflip '
 | 
					alias ig-download-and-hflip='dl_instagram_vid_and_hflip '
 | 
				
			||||||
 | 
					
 | 
				
			||||||
compression_quality=27 # 27 for gpu; 25 for cpu
 | 
					# Twitch Vid DL
 | 
				
			||||||
 | 
					alias tw-src='dl_twitch_vid "Source" $SHORTNAME_OFF $COMPRESSION_OFF'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
alias tw-src='dl_twitch_vid "Source" 0 0'
 | 
					alias tw='dl_twitch_vid "1080p" $SHORTNAME_OFF $COMPRESSION_OFF'
 | 
				
			||||||
 | 
					alias tw-compressed='dl_twitch_vid "1080p" $SHORTNAME_OFF $COMPRESSION_ON'
 | 
				
			||||||
alias tw='dl_twitch_vid "1080p" 0 0'
 | 
					alias tw-shortname='dl_twitch_vid "1080p" $SHORTNAME_ON $COMPRESSION_OFF'
 | 
				
			||||||
alias tw-compressed='dl_twitch_vid "1080p" 0 $compression_quality'
 | 
					alias tw-shortname-compressed='dl_twitch_vid "1080p" $SHORTNAME_ON $COMPRESSION_ON'
 | 
				
			||||||
alias tw-shortname='dl_twitch_vid "1080p" 1 0'
 | 
					 | 
				
			||||||
alias tw-shortname-compressed='dl_twitch_vid "1080p" 1 $compression_quality'
 | 
					 | 
				
			||||||
alias tw-custom='dl_twitch_vid '
 | 
					alias tw-custom='dl_twitch_vid '
 | 
				
			||||||
alias tw-chat='dl_twitch_chat'
 | 
					alias tw-chat='dl_twitch_chat'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
alias tw-1080='dl_twitch_vid "1080" 0 0'
 | 
					alias tw-1080='dl_twitch_vid "1080" $SHORTNAME_OFF $COMPRESSION_OFF'
 | 
				
			||||||
alias tw-1080-compressed='dl_twitch_vid "1080" 0 $compression_quality'
 | 
					alias tw-1080-compressed='dl_twitch_vid "1080" $SHORTNAME_OFF $COMPRESSION_ON'
 | 
				
			||||||
alias tw-1080-shortname='dl_twitch_vid "1080" 1 0'
 | 
					alias tw-1080-shortname='dl_twitch_vid "1080" $SHORTNAME_ON $COMPRESSION_OFF'
 | 
				
			||||||
alias tw-1080-shortname-compressed='dl_twitch_vid "1080" 1 $compression_quality'
 | 
					alias tw-1080-shortname-compressed='dl_twitch_vid "1080" $SHORTNAME_ON $COMPRESSION_ON'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
alias tw-1080p60='dl_twitch_vid "1080p60" 0 0'
 | 
					alias tw-1080p60='dl_twitch_vid "1080p60" $SHORTNAME_OFF $COMPRESSION_OFF'
 | 
				
			||||||
alias tw-1080p50='dl_twitch_vid "1080p50" 0 0'
 | 
					alias tw-1080p50='dl_twitch_vid "1080p50" $SHORTNAME_OFF $COMPRESSION_OFF'
 | 
				
			||||||
alias tw-1080p60-compressed='dl_twitch_vid "1080p60" 0 $compression_quality'
 | 
					alias tw-1080p60-compressed='dl_twitch_vid "1080p60" $SHORTNAME_OFF $COMPRESSION_ON'
 | 
				
			||||||
alias tw-1080p50-compressed='dl_twitch_vid "1080p50" 0 $compression_quality'
 | 
					alias tw-1080p50-compressed='dl_twitch_vid "1080p50" $SHORTNAME_OFF $COMPRESSION_ON'
 | 
				
			||||||
alias tw-1080p60-shortname='dl_twitch_vid "1080p60" 1 0'
 | 
					alias tw-1080p60-shortname='dl_twitch_vid "1080p60" $SHORTNAME_ON $COMPRESSION_OFF'
 | 
				
			||||||
alias tw-1080p50-shortname='dl_twitch_vid "1080p50" 1 0'
 | 
					alias tw-1080p50-shortname='dl_twitch_vid "1080p50" $SHORTNAME_ON $COMPRESSION_OFF'
 | 
				
			||||||
alias tw-1080p60-shortname-compressed='dl_twitch_vid "1080p60" 1 $compression_quality'
 | 
					alias tw-1080p60-shortname-compressed='dl_twitch_vid "1080p60" $SHORTNAME_ON $COMPRESSION_ON'
 | 
				
			||||||
alias tw-1080p50-shortname-compressed='dl_twitch_vid "1080p50" 1 $compression_quality'
 | 
					alias tw-1080p50-shortname-compressed='dl_twitch_vid "1080p50" $SHORTNAME_ON $COMPRESSION_ON'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
alias tw-720='dl_twitch_vid "720p" 0 0'
 | 
					alias tw-720='dl_twitch_vid "720p" $SHORTNAME_OFF $COMPRESSION_OFF'
 | 
				
			||||||
alias tw-720-compressed='dl_twitch_vid "720p-1" 0 $compression_quality'
 | 
					alias tw-720-compressed='dl_twitch_vid "720p-1" $SHORTNAME_OFF $COMPRESSION_ON'
 | 
				
			||||||
alias tw-720-shortname='dl_twitch_vid "720p-1" 1 0'
 | 
					alias tw-720-shortname='dl_twitch_vid "720p-1" $SHORTNAME_ON $COMPRESSION_OFF'
 | 
				
			||||||
alias tw-720-60='dl_twitch_vid "720p60" 0 0'
 | 
					alias tw-720-60='dl_twitch_vid "720p60" $SHORTNAME_OFF $COMPRESSION_OFF'
 | 
				
			||||||
alias tw-720-60-shortname='dl_twitch_vid "720p60" 1 0'
 | 
					alias tw-720-60-shortname='dl_twitch_vid "720p60" $SHORTNAME_ON $COMPRESSION_OFF'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
alias tw-4k='dl_twitch_vid "2160p" 0 0'
 | 
					alias tw-4k='dl_twitch_vid "2160p" $SHORTNAME_OFF $COMPRESSION_OFF'
 | 
				
			||||||
alias tw-4k-compressed='dl_twitch_vid "2160p" 0 $compression_quality'
 | 
					alias tw-4k-compressed='dl_twitch_vid "2160p" $SHORTNAME_OFF $COMPRESSION_ON'
 | 
				
			||||||
alias tw-4k-shortname='dl_twitch_vid "2160p" 1 0'
 | 
					alias tw-4k-shortname='dl_twitch_vid "2160p" $SHORTNAME_ON $COMPRESSION_OFF'
 | 
				
			||||||
alias tw-4k-shortname-compressed='dl_twitch_vid "2160p" 1 $compression_quality'
 | 
					alias tw-4k-shortname-compressed='dl_twitch_vid "2160p" $SHORTNAME_ON $COMPRESSION_ON'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
alias tw-source='dl_twitch_vid "Source" 0 0'
 | 
					alias tw-source='dl_twitch_vid "Source" $SHORTNAME_OFF $COMPRESSION_OFF'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Vimeo Vid DL
 | 
				
			||||||
 | 
					alias vimeo='dl_vimeo_vid "Original" $SHORTNAME_OFF $COMPRESSION_OFF'
 | 
				
			||||||
 | 
					alias vimeo-compressed='dl_vimeo_vid "Original" $SHORTNAME_OFF $COMPRESSION_ON'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Misc
 | 
				
			||||||
alias download-mp4='dl_mp4'
 | 
					alias download-mp4='dl_mp4'
 | 
				
			||||||
alias download-from-m3u8='dl_from_m3u8'
 | 
					alias download-from-m3u8='dl_from_m3u8'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Video Compression
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					function _compress_video_hard() {
 | 
				
			||||||
 | 
					    local crf=35
 | 
				
			||||||
 | 
					    local name="$1"
 | 
				
			||||||
 | 
					    local out="$2"
 | 
				
			||||||
 | 
					    if [[ name == "" || out == "" ]]; then
 | 
				
			||||||
 | 
					        error "Format: cmd <source> <dest>\n"
 | 
				
			||||||
 | 
					        return
 | 
				
			||||||
 | 
					    fi
 | 
				
			||||||
 | 
					    # 1 arg = use GPU
 | 
				
			||||||
 | 
					    compress-video-with-crf 1 $crf "$name" "$out"
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					alias compress-video-hard='_compress_video_hard'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
####################################################################################################
 | 
					####################################################################################################
 | 
				
			||||||
# Git
 | 
					# Git
 | 
				
			||||||
####################################################################################################
 | 
					####################################################################################################
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -24,50 +24,48 @@ else
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
if [[ $1 == "" ]]; then
 | 
					if [[ $1 == "" ]]; then
 | 
				
			||||||
    printf "\n${BOLD}Usage: $0 <filename> <optional crf value> <optional output name>\n - If you want to encode a range of CRF values then use -1 as the crf value.${NORMAL}\n"
 | 
					    printf "${BOLD}${RED}Usage: $0 <use-gpu (1|0)> <filename> <optional output name>${NORMAL}\n"
 | 
				
			||||||
    exit 1
 | 
					    exit 1
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
filename=$(basename -- "$1")
 | 
					use_gpu=$1
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					filename=$(basename -- "$2")
 | 
				
			||||||
extension="${filename##*.}"
 | 
					extension="${filename##*.}"
 | 
				
			||||||
filename="${filename%.*}"
 | 
					filename="${filename%.*}"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
use_crf=$2
 | 
					 | 
				
			||||||
default_crf=25 # Programming vids have pretty crisp text @ crf 25.
 | 
					 | 
				
			||||||
output_name="$3"
 | 
					output_name="$3"
 | 
				
			||||||
use_cpu=$4
 | 
					
 | 
				
			||||||
 | 
					use_crf=25 # Found the following to work best with vids containing text (e.g. programming vid): 25 for CPU encoding and 27 for GPU.
 | 
				
			||||||
 | 
					if [[ $use_gpu -eq 1 ]]; then
 | 
				
			||||||
 | 
					    use_crf=27
 | 
				
			||||||
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function encode() {
 | 
					function encode() {
 | 
				
			||||||
    crf=$1
 | 
					    crf=$1
 | 
				
			||||||
    if [[ $output_name == "" ]]; then
 | 
					    if [[ $output_name == "" ]]; then
 | 
				
			||||||
        output="${filename}_REDUCED_CRF-${crf}.$extension"
 | 
					        output="${filename}_COMPRESSED_CRF-${crf}.$extension"
 | 
				
			||||||
    else
 | 
					    else
 | 
				
			||||||
        output="${output_name}.$extension"
 | 
					        output="${output_name}.$extension"
 | 
				
			||||||
    fi
 | 
					    fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    printf "\n${YELLOW}${BOLD}Encoding '$filename.$extension' with CRF $crf | output: $output${NORMAL}\n"
 | 
					    printf "\n${YELLOW}${BOLD}Encoding '$filename.$extension' | GPU: $use_gpu | CRF $crf | output: $output${NORMAL}\n"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if [[ $use_cpu -eq 1 ]]; then
 | 
					    if [[ $use_gpu -eq 1 ]]; then
 | 
				
			||||||
        ffmpeg -i "$filename.$extension" -c:v libx264 -crf $crf -preset veryfast -profile:v baseline -level 3.0 -strict -2 "$output"
 | 
					 | 
				
			||||||
    else
 | 
					 | 
				
			||||||
        # File will be slightly larger than CPU encoding, but it's much faster to transcode and doesn't max out the CPU cores.
 | 
					        # File will be slightly larger than CPU encoding, but it's much faster to transcode and doesn't max out the CPU cores.
 | 
				
			||||||
        ffmpeg -y -vsync 0 -hwaccel cuvid -c:v h264_cuvid -i "$filename.$extension" -c:a copy -c:v h264_nvenc -profile:v high -rc:v vbr_hq -cq:v $crf -b:v 5M -maxrate 5M -max_muxing_queue_size 9999 "$output"
 | 
					        ffmpeg -y -vsync 0 -hwaccel cuvid -c:v h264_cuvid -i "$filename.$extension" -c:a copy -c:v h264_nvenc -profile:v high -rc:v vbr_hq -cq:v $crf -b:v 5M -maxrate 5M -max_muxing_queue_size 9999 "$output"
 | 
				
			||||||
 | 
					    else
 | 
				
			||||||
 | 
					        ffmpeg -i "$filename.$extension" -c:v libx264 -crf $crf -preset veryfast -profile:v baseline -level 3.0 -strict -2 "$output"
 | 
				
			||||||
    fi
 | 
					    fi
 | 
				
			||||||
    printf "\n${GREEN}${BOLD}Done encoding '$filename.$extension' with CRF $crf${NORMAL}\n\n"
 | 
					    printf "\n${GREEN}${BOLD}Done encoding '$filename.$extension' (CRF $crf) | output name '$output'${NORMAL}\n\n"
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
if [[ $use_crf == "" ]]; then
 | 
					encode $use_crf
 | 
				
			||||||
    use_crf=$default_crf
 | 
					 | 
				
			||||||
fi
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
if [[ $use_crf == -1 ]]; then
 | 
					#printf "\n${YELLOW}${BOLD}Encoding using a range of CRF values.${NORMAL}\n"
 | 
				
			||||||
    printf "\n${YELLOW}${BOLD}Encoding using a range of CRF values.${NORMAL}\n"
 | 
					## Bigger crf values == bigger compression.
 | 
				
			||||||
 | 
					#for crf in {25..28}
 | 
				
			||||||
 | 
					#do
 | 
				
			||||||
 | 
					#    encode $crf
 | 
				
			||||||
 | 
					#done
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # Bigger crf values == bigger compression.
 | 
					 | 
				
			||||||
    for crf in {25..28}
 | 
					 | 
				
			||||||
    do
 | 
					 | 
				
			||||||
        encode $crf
 | 
					 | 
				
			||||||
    done
 | 
					 | 
				
			||||||
else
 | 
					 | 
				
			||||||
    encode $use_crf
 | 
					 | 
				
			||||||
fi
 | 
					 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										69
									
								
								bin/compress-video-with-crf
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										69
									
								
								bin/compress-video-with-crf
									
									
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,69 @@
 | 
				
			||||||
 | 
					#!/usr/bin/env bash
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if which tput >/dev/null 2>&1; then
 | 
				
			||||||
 | 
					    ncolors=$(tput colors)
 | 
				
			||||||
 | 
					fi
 | 
				
			||||||
 | 
					if [ -t 1 ] && [ -n "$ncolors" ] && [ "$ncolors" -ge 8 ]; then
 | 
				
			||||||
 | 
					    RED="$(tput setaf 1)"
 | 
				
			||||||
 | 
					    GREEN="$(tput setaf 2)"
 | 
				
			||||||
 | 
					    YELLOW="$(tput setaf 3)"
 | 
				
			||||||
 | 
					    BLUE="$(tput setaf 4)"
 | 
				
			||||||
 | 
					    MAGENTA="$(tput setaf 5)"
 | 
				
			||||||
 | 
					    CYAN="$(tput setaf 6)"
 | 
				
			||||||
 | 
					    BOLD="$(tput bold)"
 | 
				
			||||||
 | 
					    NORMAL="$(tput sgr0)"
 | 
				
			||||||
 | 
					else
 | 
				
			||||||
 | 
					    RED=""
 | 
				
			||||||
 | 
					    GREEN=""
 | 
				
			||||||
 | 
					    YELLOW=""
 | 
				
			||||||
 | 
					    BLUE=""
 | 
				
			||||||
 | 
					    MAGENTA=""
 | 
				
			||||||
 | 
					    CYAN=""
 | 
				
			||||||
 | 
					    BOLD=""
 | 
				
			||||||
 | 
					    NORMAL=""
 | 
				
			||||||
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if [[ $1 == "" ]]; then
 | 
				
			||||||
 | 
					    printf "${BOLD}${RED}Usage: $0 <use-gpu (1|0)> <crf value> <filename> <optional output name>\n\nIf you want to encode a range of CRF values then use -1 as the crf value.${NORMAL}\n"
 | 
				
			||||||
 | 
					    exit 1
 | 
				
			||||||
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					use_gpu=$1
 | 
				
			||||||
 | 
					use_crf=$2
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					filename=$(basename -- "$3")
 | 
				
			||||||
 | 
					extension="${filename##*.}"
 | 
				
			||||||
 | 
					filename="${filename%.*}"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					output_name="$4"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					function encode() {
 | 
				
			||||||
 | 
					    crf=$1
 | 
				
			||||||
 | 
					    if [[ $output_name == "" ]]; then
 | 
				
			||||||
 | 
					        output="${filename}_COMPRESSED_CRF-${crf}.$extension"
 | 
				
			||||||
 | 
					    else
 | 
				
			||||||
 | 
					        output="${output_name}.$extension"
 | 
				
			||||||
 | 
					    fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    printf "\n${YELLOW}${BOLD}Encoding '$filename.$extension' | GPU: $use_gpu | CRF $crf | output: $output${NORMAL}\n"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if [[ $use_gpu -eq 1 ]]; then
 | 
				
			||||||
 | 
					        # File will be slightly larger than CPU encoding, but it's much faster to transcode and doesn't max out the CPU cores.
 | 
				
			||||||
 | 
					        ffmpeg -y -vsync 0 -hwaccel cuvid -c:v h264_cuvid -i "$filename.$extension" -c:a copy -c:v h264_nvenc -profile:v high -rc:v vbr_hq -cq:v $crf -b:v 5M -maxrate 5M -max_muxing_queue_size 9999 "$output"
 | 
				
			||||||
 | 
					    else
 | 
				
			||||||
 | 
					        ffmpeg -i "$filename.$extension" -c:v libx264 -crf $crf -preset veryfast -profile:v baseline -level 3.0 -strict -2 "$output"
 | 
				
			||||||
 | 
					    fi
 | 
				
			||||||
 | 
					    printf "\n${GREEN}${BOLD}Done encoding '$filename.$extension' (CRF $crf) | output name '$output'${NORMAL}\n\n"
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if [[ $use_crf -ne -1 ]]; then
 | 
				
			||||||
 | 
					    encode $use_crf
 | 
				
			||||||
 | 
					else
 | 
				
			||||||
 | 
					    printf "\n${YELLOW}${BOLD}Encoding using a range of CRF values.${NORMAL}\n"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    # Bigger crf values == bigger compression.
 | 
				
			||||||
 | 
					    for crf in {25..28}
 | 
				
			||||||
 | 
					    do
 | 
				
			||||||
 | 
					        encode $crf
 | 
				
			||||||
 | 
					    done
 | 
				
			||||||
 | 
					fi
 | 
				
			||||||
							
								
								
									
										0
									
								
								configs/firefox/README.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								configs/firefox/README.txt
									
									
									
									
									
										Normal file
									
								
							
							
								
								
									
										10
									
								
								configs/firefox/userChrome.css
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								configs/firefox/userChrome.css
									
									
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,10 @@
 | 
				
			||||||
 | 
					/* Hide the top tabs toolbar. 
 | 
				
			||||||
 | 
					   To install this: 
 | 
				
			||||||
 | 
					       * Go to your Firefox profile folder (look in %appdata%/Mozilla/Firefox/Profiles)
 | 
				
			||||||
 | 
					       * Create a 'chrome' folder and place this there.
 | 
				
			||||||
 | 
					       * In Firefox, go to about:config and set `toolkit.legacyUserProfileCustomizations.stylesheets` to true. 
 | 
				
			||||||
 | 
					       * Restart the browser.
 | 
				
			||||||
 | 
					*/
 | 
				
			||||||
 | 
					#TabsToolbar {
 | 
				
			||||||
 | 
						display: none !important;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										36
									
								
								vimrc
									
									
									
									
									
								
							
							
						
						
									
										36
									
								
								vimrc
									
									
									
									
									
								
							| 
						 | 
					@ -56,10 +56,11 @@ let g:campo_light_theme = 'campo-light-simple'
 | 
				
			||||||
let g:campo_theme_use_rainbow_parens = 1
 | 
					let g:campo_theme_use_rainbow_parens = 1
 | 
				
			||||||
"--------------------------------------------
 | 
					"--------------------------------------------
 | 
				
			||||||
 | 
					
 | 
				
			||||||
" You can further customize things in a private vimrc. I use this
 | 
					" You can further customize things in a private vimrc. I use this for things
 | 
				
			||||||
" for things that I don't want included in my public dotfiles repo
 | 
					" that I don't want included in my public dotfiles repo such as temp file settings.
 | 
				
			||||||
" such as temp file settings.
 | 
					if filereadable($HOME . "/.vimrc.private")
 | 
				
			||||||
source ~/.vimrc.private
 | 
					    source $HOME/.vimrc.private
 | 
				
			||||||
 | 
					endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
"################################################################
 | 
					"################################################################
 | 
				
			||||||
"################################################################
 | 
					"################################################################
 | 
				
			||||||
| 
						 | 
					@ -467,9 +468,12 @@ augroup campoCmds
 | 
				
			||||||
    autocmd BufReadPre *.asm let g:asmsyntax = "fasm"
 | 
					    autocmd BufReadPre *.asm let g:asmsyntax = "fasm"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    " Auto reload VIM when settings changed.
 | 
					    " Auto reload VIM when settings changed.
 | 
				
			||||||
    autocmd BufWritePost .vimrc so $MYVIMRC
 | 
					    " @fixme Reload lvimrc after sourcing this file on a save. I tried calling
 | 
				
			||||||
    autocmd BufWritePost *.vim so $MYVIMRC
 | 
					    " a function that does the source and a call to lvimrc's API but got an
 | 
				
			||||||
    autocmd BufWritePost ~/.vimrc.private so $MYVIMRC
 | 
					    " error complaining that the function cannot be created while it's in use.
 | 
				
			||||||
 | 
					    autocmd BufWritePost .vimrc source $MYVIMRC
 | 
				
			||||||
 | 
					    autocmd BufWritePost *.vim source $MYVIMRC
 | 
				
			||||||
 | 
					    autocmd BufWritePost ~/.vimrc.private source $MYVIMRC
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    function! s:RunCtags()
 | 
					    function! s:RunCtags()
 | 
				
			||||||
        " The ampersand at the end is to make this run in the background. I had to
 | 
					        " The ampersand at the end is to make this run in the background. I had to
 | 
				
			||||||
| 
						 | 
					@ -532,7 +536,7 @@ nmap <leader>z <c-z>
 | 
				
			||||||
" Open the vimrc file for editing / reload vimrc file.
 | 
					" Open the vimrc file for editing / reload vimrc file.
 | 
				
			||||||
nmap <silent> <leader>ev :vsp $MYVIMRC<cr>
 | 
					nmap <silent> <leader>ev :vsp $MYVIMRC<cr>
 | 
				
			||||||
nmap <silent> <leader>pv :vsp ~/.vimrc.private<cr>
 | 
					nmap <silent> <leader>pv :vsp ~/.vimrc.private<cr>
 | 
				
			||||||
nmap <silent> <leader>rv :so $MYVIMRC<cr>
 | 
					nmap <silent> <leader>rv :source $MYVIMRC<cr>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
" Type %/ in the command bar to have it replaced with the current buffer's
 | 
					" Type %/ in the command bar to have it replaced with the current buffer's
 | 
				
			||||||
" path if the file is on disk. One thing I noticed is that you have to type
 | 
					" path if the file is on disk. One thing I noticed is that you have to type
 | 
				
			||||||
| 
						 | 
					@ -1070,8 +1074,8 @@ nnoremap <C-p> :cp<CR>
 | 
				
			||||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 | 
					"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 | 
				
			||||||
 | 
					
 | 
				
			||||||
" Search using ripgrep (first install with Rust: cargo install ripgrep).
 | 
					" Search using ripgrep (first install with Rust: cargo install ripgrep).
 | 
				
			||||||
function! Search(case_sensitive)
 | 
					function! Search(case_sensitive, search_args)
 | 
				
			||||||
    let l:helper = "[" . (a:case_sensitive ? "case-sensitive" : "case-insensitive") . "] search: "
 | 
					    let l:helper = "Search [" . a:search_args . " | " . (a:case_sensitive ? "case-sensitive" : "case-insensitive") . "]: "
 | 
				
			||||||
    let l:term = input(l:helper)
 | 
					    let l:term = input(l:helper)
 | 
				
			||||||
    if empty(l:term)
 | 
					    if empty(l:term)
 | 
				
			||||||
        return
 | 
					        return
 | 
				
			||||||
| 
						 | 
					@ -1079,7 +1083,7 @@ function! Search(case_sensitive)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    "@note --pretty (i.e. colors) is not enabled in vim-ripgrep because the
 | 
					    "@note --pretty (i.e. colors) is not enabled in vim-ripgrep because the
 | 
				
			||||||
    "quickfix window doesn't seem to parse the ansi color codes.
 | 
					    "quickfix window doesn't seem to parse the ansi color codes.
 | 
				
			||||||
    let l:rg_args = "--column --line-number --no-heading --fixed-strings --no-ignore --hidden --follow --trim -g \"!tags\" " . g:campo_custom_search_args
 | 
					    let l:rg_args = "--column --line-number --no-heading --fixed-strings --no-ignore --hidden --follow --trim -g \"!tags\" " . a:search_args
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if !a:case_sensitive
 | 
					    if !a:case_sensitive
 | 
				
			||||||
        let l:rg_args .= " --ignore-case"
 | 
					        let l:rg_args .= " --ignore-case"
 | 
				
			||||||
| 
						 | 
					@ -1087,8 +1091,14 @@ function! Search(case_sensitive)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    exec 'Rg ' . l:rg_args . ' "' . l:term . '"'
 | 
					    exec 'Rg ' . l:rg_args . ' "' . l:term . '"'
 | 
				
			||||||
endfunction
 | 
					endfunction
 | 
				
			||||||
map <leader>s :call Search(0)<cr>
 | 
					
 | 
				
			||||||
map <leader>ss :call Search(1)<cr>
 | 
					" Case insensitive
 | 
				
			||||||
 | 
					map <leader>s :call Search(0, g:campo_custom_search_args)<cr>
 | 
				
			||||||
 | 
					noremap <F2> :call Search(0, g:campo_custom_search_args_2)<cr>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					" Case sensitive
 | 
				
			||||||
 | 
					map <leader>ss :call Search(1, g:campo_custom_search_args)<cr>
 | 
				
			||||||
 | 
					noremap <F3> :call Search(1, g:campo_custom_search_args_2)<cr>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
" Navigation for the vim-ripgrep search results.
 | 
					" Navigation for the vim-ripgrep search results.
 | 
				
			||||||
" Hit o on a result line to open the file at that line.
 | 
					" Hit o on a result line to open the file at that line.
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,67 @@
 | 
				
			||||||
 | 
					////////////////////////////////////////////////////////////////////////////
 | 
				
			||||||
 | 
					// ADOBE SYSTEMS INCORPORATED
 | 
				
			||||||
 | 
					// Copyright 2008-2017 Adobe Systems Incorporated
 | 
				
			||||||
 | 
					// All Rights Reserved
 | 
				
			||||||
 | 
					//
 | 
				
			||||||
 | 
					// NOTICE:  Adobe permits you to use, modify, and distribute this file in accordance with the
 | 
				
			||||||
 | 
					// terms of the Adobe license agreement accompanying it.  If you have received this file from a
 | 
				
			||||||
 | 
					// source other than Adobe, then your use, modification, or distribution of it requires the prior
 | 
				
			||||||
 | 
					// written permission of Adobe.
 | 
				
			||||||
 | 
					/////////////////////////////////////////////////////////////////////////////
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// Works around the lack of a permanently enabled "Show Items from Subfolders" option (aka flat view). 
 | 
				
			||||||
 | 
					// The default behaviour is to turn off the option when changing folders. This extension enables the 
 | 
				
			||||||
 | 
					// flat view when the app starts and then keeps it enabled when changing folders. You can disable this 
 | 
				
			||||||
 | 
					// behaviour by disabling the "Always Show Items from Subfolders" option.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					function AlwaysFlatViewSetting() {
 | 
				
			||||||
 | 
						this.requiredContext = "\tAdobe Bridge must be running.\n";
 | 
				
			||||||
 | 
						this.menuID = "alwaysFlatViewSetting";
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					AlwaysFlatViewSetting.prototype.run = function() {
 | 
				
			||||||
 | 
						if (!this.canRun()) return false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						var toggleFlatView = function(enable) {
 | 
				
			||||||
 | 
							var task = 'MenuElement.find("FlatView").checked = ' + (enable ? 'true' : 'false');
 | 
				
			||||||
 | 
							app.scheduleTask(task, 0, false);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						var label = "Always Show Items from Subfolders";
 | 
				
			||||||
 | 
						var menuItem = new MenuElement( "command", label, "after FlatView");
 | 
				
			||||||
 | 
						menuItem.canBeChecked = true;
 | 
				
			||||||
 | 
						menuItem.checked      = true;
 | 
				
			||||||
 | 
						menuItem.onSelect     = function() {
 | 
				
			||||||
 | 
							menuItem.checked = !menuItem.checked;
 | 
				
			||||||
 | 
							toggleFlatView(menuItem.checked);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// Triggered when changing folders or selecting some menu option.
 | 
				
			||||||
 | 
						onSelectItem = function(event) {	
 | 
				
			||||||
 | 
							if (event.object instanceof Document && event.type == "selectionsChanged") {
 | 
				
			||||||
 | 
								if (menuItem.checked) {
 | 
				
			||||||
 | 
									toggleFlatView(true);
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
								return {handled:false};  // continue handling all other event handlers
 | 
				
			||||||
 | 
							}		
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						app.eventHandlers.push({handler: onSelectItem});	
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
 | 
						return true;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					AlwaysFlatViewSetting.prototype.canRun = function() {	
 | 
				
			||||||
 | 
						if (BridgeTalk.appName == "bridge") {
 | 
				
			||||||
 | 
							if (MenuElement.find(this.menuID)) {
 | 
				
			||||||
 | 
								return false; // Item already exists.
 | 
				
			||||||
 | 
							} 
 | 
				
			||||||
 | 
							return true;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						$.writeln("ERROR:: Cannot run AlwaysFlatViewSetting");
 | 
				
			||||||
 | 
						$.writeln(this.requiredContext);
 | 
				
			||||||
 | 
						return false;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if (typeof(AlwaysFlatViewSetting_unitTest ) == "undefined") {
 | 
				
			||||||
 | 
						new AlwaysFlatViewSetting().run();
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										2
									
								
								windows/disable-windows-error-reporting-dialog.bat
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								windows/disable-windows-error-reporting-dialog.bat
									
									
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,2 @@
 | 
				
			||||||
 | 
					reg add "HKLM\Software\Microsoft\Windows\Windows Error Reporting" /v "Disabled" /t REG_DWORD /d 1 /f
 | 
				
			||||||
 | 
					reg add "HKLM\System\CurrentControlSet\Services\WerSvc" /v "Start" /t REG_DWORD /d 4 /f
 | 
				
			||||||
| 
						 | 
					@ -19,6 +19,9 @@
 | 
				
			||||||
    * AFAIK this only works for Intel CPUs; not sure how to do the same thing on AMD.
 | 
					    * AFAIK this only works for Intel CPUs; not sure how to do the same thing on AMD.
 | 
				
			||||||
    * In the power plan set the processor min/max speed to 99%.
 | 
					    * In the power plan set the processor min/max speed to 99%.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					* Disable Windows error reporting dialog so that when stuff crashes you can get to a debugger faster.
 | 
				
			||||||
 | 
					    * Open an admin cmd prompt and run the file `disable-windows-error-reporting-dialog.bat` from this directory.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
* Optional: disable Windows Defender real-time protection:
 | 
					* Optional: disable Windows Defender real-time protection:
 | 
				
			||||||
    * This can speed up compilation times since Defender will scan every file written to disk. I was
 | 
					    * This can speed up compilation times since Defender will scan every file written to disk. I was
 | 
				
			||||||
      able to shave off ~2-5 seconds in a particular project.
 | 
					      able to shave off ~2-5 seconds in a particular project.
 | 
				
			||||||
| 
						 | 
					@ -106,8 +109,11 @@ processor time and is generally useless.
 | 
				
			||||||
* Install the Windows SDK https://developer.microsoft.com/en-us/windows/downloads/windows-10-sdk
 | 
					* Install the Windows SDK https://developer.microsoft.com/en-us/windows/downloads/windows-10-sdk
 | 
				
			||||||
* Download [O&O ShutUp10](https://www.oo-software.com/en/shutup10) and disable things.
 | 
					* Download [O&O ShutUp10](https://www.oo-software.com/en/shutup10) and disable things.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## Setup up Unix-like Shell
 | 
					## Setup Terminal
 | 
				
			||||||
* Install [MSYS2 w/ MinGW-w64](http://www.msys2.org/) to `C:\msys64`
 | 
					* Install [MSYS2 w/ MinGW-w64](http://www.msys2.org/) to `C:\msys64`
 | 
				
			||||||
 | 
					  * MinGW is intended for developing native Windows applications. MSYS is for developing software
 | 
				
			||||||
 | 
					    that runs inside of the MSYS2 posix-like env with FHS style filesystem naming (i.e. MSYS2
 | 
				
			||||||
 | 
					    tools/packages).
 | 
				
			||||||
  * Open `C:\msys64\mingw64.exe`
 | 
					  * Open `C:\msys64\mingw64.exe`
 | 
				
			||||||
  * Run `pacman -Syu`, then restart the terminal and run `pacman -Su`.
 | 
					  * Run `pacman -Syu`, then restart the terminal and run `pacman -Su`.
 | 
				
			||||||
  * Run `pacman -S base-devel mingw-w64-x86_64-toolchain git bc`
 | 
					  * Run `pacman -S base-devel mingw-w64-x86_64-toolchain git bc`
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user