Compare commits

...

78 Commits

Author SHA1 Message Date
d19e60cfc3 Changed the worktree to one directory back (i.e. $HOME) and simplified the setup 2023-06-14 02:02:43 -04:00
0ee1e7666e Prep work before we use the new setup 2023-06-13 15:45:28 -04:00
c7845e62d9 Make moving lines easier in vim and change the tab listchar 2023-06-13 14:56:35 -04:00
2a57ce8837 Rename stuff in vimrc 2023-06-12 22:51:42 -04:00
a529cd6560 Improve vimrc - abbreviation fix, some leader stuff 2023-06-12 22:50:02 -04:00
589abb9e46 Tweak whisper core/thread count 2023-06-12 22:49:45 -04:00
6df4a1e506 Add a registry key for disabling the Windows platform binary table 2023-06-09 17:20:39 -04:00
10c6e8e06c Update aliases 2023-06-09 17:20:24 -04:00
f70bc8b9cd Alias tweaks around video dl 2023-06-06 15:48:43 -04:00
dad6be889f More transcription script improvements 2023-06-05 17:12:16 -04:00
e979d1094c Set whisper thread count based on the model 2023-06-05 14:18:44 -04:00
ce1599466e Update aliases with some audio transcription stuff 2023-06-05 01:23:47 -04:00
e5e8f309e5 Improve transcribe api and add alias to transcribe twitch stream downloads 2023-06-04 14:40:45 -04:00
8ff9c338b5 Add vimrc function for searching specific extensions 2023-06-03 17:42:42 -04:00
173bda9eb0 Add scripts for audio transcription using whisper.cpp 2023-06-03 17:42:30 -04:00
06bbc0c995 Use absolute path to build.jai 2023-06-03 16:22:13 -04:00
f19e84e1a5 Change some vim mappings 2023-05-21 18:02:21 -04:00
1a46964bd7 Tweak Windows key remapping notes 2023-05-16 12:05:46 -04:00
0e91857946 Note on disabling Cortana 2023-05-14 21:31:22 -04:00
bb31351404 Explain how to map caps to ctrl for wireless keyboards connected to a Steam Link 2023-05-12 18:35:13 -04:00
7b031d3127 More tweaks to the vimrc run function 2023-05-10 14:56:43 -04:00
c05131d38f Move a vimrc function so that it can be called in a private vimrc 2023-05-10 13:06:52 -04:00
418d1ae956 Fix typo in vimrc 2023-05-08 23:34:04 -04:00
e614936478 Add a trim video script that is more accurate 2023-05-07 16:11:49 -04:00
5bed58e55c Split jai compiler and metaprogram args in vimrc 2023-05-06 22:07:05 -04:00
6800f7ccc4 Improve jai build code in vimrc 2023-05-06 22:01:03 -04:00
40eb9aa808 SSH notes 2023-05-01 04:50:41 -04:00
53082c6034 Tweak some vim build/run stuff around jai 2023-05-01 04:50:36 -04:00
f084b19637 Add x32dbg wrapper script 2023-04-26 15:46:12 -04:00
4323bd9721 Add a note about disabling the annoying windows alert sound 2023-04-06 12:17:03 -04:00
28c88ca5f1 Stop git from changing line endings on Windows and add support for editorconfig in vim 2023-03-16 16:44:38 -04:00
4464e4f681 Add a script that removes audio from a video 2023-03-16 12:59:38 -04:00
08a26b6716 Update windows readme 2023-03-13 19:07:15 -04:00
84b221bdb9 Renaming alias stuff 2023-03-01 15:27:38 -05:00
2e07b0c85f vim build and run updates 2023-03-01 15:27:26 -05:00
d664ba882c Do our own save call when compiling files in vim 2023-02-01 17:11:25 -05:00
2f9dc3aba7 Add batch file for running x64dbg 2023-02-01 16:43:26 -05:00
f0248008a6 Add a vim function to toggle a 'simple' view of the current buffer 2023-01-30 13:57:38 -05:00
7e586d284d Formatting changes in vimrc 2023-01-27 16:04:50 -05:00
816a0be564 Disable vim terminal cmd 2023-01-26 15:54:02 -05:00
cef7886859 vimrc cleanup (move templates, remove static scopes) 2023-01-24 14:08:56 -05:00
9e07b24cf7 Escape some characters in vim rip-grep search 2023-01-22 08:34:29 -05:00
12969578aa Change vim centering offset 2023-01-22 08:34:06 -05:00
89d5709677 Update vim color scheme 2023-01-19 19:10:47 -05:00
2343c46b89 Set jai build args in a private vimrc 2023-01-19 18:13:38 -05:00
9371817937 Improve jai search and compiling in vim 2023-01-04 22:25:15 -05:00
8eccc9659a Clean up some aliases 2023-01-04 22:24:48 -05:00
45d3fa244a Clean up vim search and import local jai modules when building 2022-12-30 18:47:27 -05:00
2640761dc5 Improve ctrlp ctag situation and add some jai searching 2022-12-29 19:20:11 -05:00
0227534656 Improve vim theme toggling 2022-12-29 18:53:54 -05:00
78fd8f6d45 Update setup notes 2022-12-28 00:49:01 -05:00
736bab22ec Disable some vim plugins 2022-12-28 00:48:50 -05:00
0a7bb3c2a1 Improve the compress video scripts 2022-12-28 00:46:37 -05:00
c0dd5208a0 Tweak color scheme and vim dict 2022-12-13 17:33:51 -05:00
7c828c01f1 Update vimrc 2022-12-10 19:40:37 -05:00
c1e333e7db Start cleaning up vim color schemes 2022-12-10 19:40:37 -05:00
4238273951 Add vim function to edit current color scheme 2022-11-29 22:33:10 -05:00
7f121ab292 Add support for info error marker in vimrc 2022-11-29 22:32:52 -05:00
f30f6eaa69 Add jai error parsing to vim 2022-11-28 23:40:04 -05:00
221985eca2 Fix parsing of cl error messages in vim so that it differentiates between an error and warning! 2022-11-28 23:39:23 -05:00
06f155f3f7 Add jai compiler support to vimrc 2022-11-28 23:37:35 -05:00
648e9bcce5 Add an mkv to mp4 script 2022-11-28 23:36:36 -05:00
b9709088a7 Clean up campo-dark-blue vim color scheme and add some Jai support 2022-11-25 22:02:22 -05:00
dfa5ecaf47 Small tweaks 2022-11-05 00:48:21 -04:00
75019980ea Tweak an alias 2022-10-27 17:00:49 -04:00
4be87e93b1 Small script/readme tweaks 2022-10-27 16:36:09 -04:00
7a7c9c87be Add scripts for disabling and enabling Windows Defender malware service 2022-10-26 16:31:04 -04:00
6965090c6f Add some batch files for dev/malware analysis work 2022-10-26 15:26:20 -04:00
ee3aa1a046 Update aliases 2022-10-18 19:00:36 -04:00
ae13200d2e Update aliases 2022-09-23 13:36:18 -04:00
c0e6c0414b Tweak svn backup script 2022-08-29 12:19:58 -04:00
9ed266f056 Add twitter video download alias 2022-08-03 18:05:57 -04:00
b78306c95b Update Windows setup notes 2022-07-27 11:30:21 -04:00
d828033f36 Add a note on creating an ed25519 keypair 2022-07-20 13:46:48 -04:00
dc15320039 Tweak twitch chat download and windows install readme 2022-07-10 14:35:58 -04:00
8bc573bfad Tweak video compression params 2022-06-23 17:15:30 -04:00
6b23065119 Explicitly use vim for the git editor 2022-06-16 13:58:24 -04:00
761ef7815d Update windows setup notes 2022-06-13 15:57:57 -04:00
150 changed files with 3665 additions and 2633 deletions

View File

@@ -36,11 +36,6 @@ error() {
printf "${BOLD}${RED}$1${NORMAL}\n"
}
abort() {
error "\nAborting..."
exit 1
}
reload() {
test -f ~/.env.loader && . ~/.env.loader
}
@@ -130,37 +125,37 @@ open_explorer_here() {
# Dev build
b() {
if [ -f build ]; then ./build $@ ; else test -f build.sh && ./build.sh $@ ; fi
test -f build && ./build $@ ; test -f build.sh && ./build.sh $@ ; test -f build.jai && ./build.jai $@
}
# fast dev build
bf() {
if [ -f build ]; then ./build $@ -fast ; else test -f build.sh && ./build.sh $@ -fast ; fi
test -f build && ./build $@ -fast ; test -f build.sh && ./build.sh $@ -fast ; test -f build.jai && ./build.jai $@
}
# Optimized dev build
bb() {
if [ -f build ]; then ./build -o 1 $@ ; else test -f build.sh && ./build.sh -o 1 $@ ; fi
test -f build && ./build $@ -o 1 ; test -f build.sh && ./build.sh $@ -o 1 ; test -f build.jai && ./build.jai -release $@
}
# Production build
bp() {
if [ -f build ]; then ./build -p p $@ ; else test -f build.sh && ./build.sh -p p $@ ; fi
test -f build && ./build $@ -p p ; test -f build.sh && ./build.sh $@ -p p ; test -f build.jai && ./build.jai -release $@ - -prod
}
# Profiling build
bpf() {
if [ -f build ]; then ./build -p pf $@ ; else test -f build.sh && ./build.sh -p pf $@ ; fi
test -f build && ./build $@ -p pf ; test -f build.sh && ./build.sh $@ -p pf
}
# GPU profiling build
bgpf() {
if [ -f build ]; then ./build -p gpu $@ ; else test -f build.sh && ./build.sh -p gpu $@ ; fi
test -f build && ./build $@ -p gpu ; test -f build.sh && ./build.sh $@ -p gpu
}
# Run build
r() {
if [ -f run ]; then ./run $@ ; else test -f run.sh && ./run.sh $@ ; fi
test -f run && ./run $@ ; test -f run.sh && ./run.sh $@
}
# Build then run
@@ -194,7 +189,7 @@ alias ls='ls -F --color'
alias l='ls -lh'
alias ll='ls -lha'
alias aliases='vim ~/.dotfiles/aliases'
alias aliases='vim ~/.aliases'
alias al='aliases'
if [[ "${platform,,}" == *'ming'* ]]; then
@@ -217,7 +212,7 @@ check_signature() {
local sig_file="$4"
if [[ $hashes_file == "" || $pem_file == "" || $sig_file == "" ]]; then
error "Format: $0 <hashes file (e.g. sha512 hashes)> <pem file> <sig file>\n"
error "Usage: <hashes file (e.g. sha512 hashes)> <pem file> <sig file>"
return
fi
@@ -235,10 +230,8 @@ alias clipboard='xclip -selection c'
# Cloc alias may be overridden by a private alias
alias cloc='cloc --no3 --by-file-by-lang --skip-win-hidden'
alias cls=clear
alias code='cd ~/code'
alias cpr='cp -r'
alias dc='gdc'
alias dot='cd ~/.dotfiles'
alias duh='du -csh'
alias e='open_explorer_here "$PWD"'
alias exp='echo "Use e instead."'
@@ -265,10 +258,8 @@ alias rmrf='rm -rf'
alias s='cd ~/.ssh'
alias sc='vim ~/.ssh/config'
alias shutdown='sudo shutdown now'
alias stk='rlwrap stk-simply'
alias t='tree'
alias tag='ctags -R .'
alias tmp='cd ~/tmp'
alias v='vim'
alias vi='vim'
alias vh='vagrant halt'
@@ -287,6 +278,8 @@ custom_grep() {
local include_list=("$@")
local include_arg=""
if [[ $include_list != "" ]]; then
# We're looping like this instead of for var in "$@", because that way of looping is affecting
# my shell environment. Very strange!
for i in "${include_list[@]}"; do
include_arg+="--include=\*${i} "
done
@@ -320,9 +313,13 @@ alias grep-dev='grep_dev'
COMPRESSION_ON=1
COMPRESSION_OFF=0
SHORTNAME_ON=1
SHORTNAME_OFF=0
TRANSCRIBE_ON=1
TRANSCRIBE_OFF=0
make_vid_dir_and_cd_into() {
local url="$1"
local dir_name="$2"
@@ -346,79 +343,78 @@ make_vid_dir_and_cd_into() {
error=$?
if [[ ! $error -eq 0 ]]; then
error "Error: failed to create directory. Aborting.\n"
error "Error: failed to create directory. Aborting."
return 1
fi
return 0
}
function my_transcribe_video() {
file="$1"
output="$2"
if [[ $file == "" ]]; then
printf "Usage: <input video> <optional output name>\n"
return
fi
if [[ $output == "" ]]; then
output="${1%.*}" # just use the input name without the extension.
fi
# Tiny is fast and semi-accurate, so whatever.
# Base is pretty good overall. It has good punctuation inserting and
# catches most words. Small and medium can do better word detection at
# times, but suffer from bad punctuation. Medium is particularly bad and
# not adding commas and periods.
transcribe-video "$file" "$output" tiny base
}
function my_transcribe_video_all_models() {
file="$1"
output="$2"
if [[ $file == "" ]]; then
printf "Usage: <input video> <optional output name>\n"
return
fi
if [[ $output == "" ]]; then
output="${1%.*}" # just use the input name without the extension.
fi
transcribe-video "$file" "$output" tiny base small medium
}
# Download YouTube videos. Note that yt-dlp downloads a lot faster than streamlink.
dl_youtube_vid() {
download_youtube_vid() {
local format="$1"
local shortname="$2"
local make_folder="$3"
local url="$4"
shift 4
local transcribe="$3"
local make_folder="$4"
local url="$5"
shift 5
local opts="$@"
if [[ $url == "" ]]; then
error "Format: $0 <make folder?> <url> <optional args>\n"
error "Usage: <make folder?> <url> <optional args>"
return
fi
if [[ $format == "" ]]; then
printf "${BOLD}No format given; using best available.${NORMAL}\n"
# Download best mp4 video and best m4a audio, then merge.
format="bv*[ext=mp4]+ba[ext=m4a]"
opts+=" --merge-output-format mp4"
fi
opts+=" --write-sub --sub-lang en --embed-subs"
if [[ $make_folder == "1" ]]; then
make_vid_dir_and_cd_into $url ""
if [[ $? -ne 0 ]]; then
return
fi
fi
if [[ $shortname -eq 0 ]]; then
local name_format="%(upload_date>%Y-%m-%d)s-%(title)s-yt-%(id)s.%(ext)s"
if [[ $shortname == "1" || $transcribe == "1" ]]; then
printf "${BOLD}Downloading Youtube vid "
if [[ $shortname == "1" ]]; then printf "| ${YELLOW}using short name${NORMAL}${BOLD} "; fi
if [[ $transcribe == "1" ]]; then printf "| ${YELLOW}audio transcription on${NORMAL}${BOLD} "; fi
printf "\n\n${NORMAL}"
else
local name_format="%(upload_date>%Y-%m-%d)s-shortname-yt-%(id)s.%(ext)s"
printf "${BOLD}Downloading Youtube vid\n\n${NORMAL}"
fi
local cmd="yt-dlp.exe -f $format -o \"$name_format\" $opts $url"
eval $cmd # Need to eval in order to preserve the quotes wrapping the filename format string.
# Removing any trailing subtitle files
rm *.vtt *.srt 2>/dev/null
if [[ $make_folder == "1" ]]; then
cd ..
fi
}
# Download YouTube video and flip horizontally.
dl_youtube_vid_and_hflip() {
local format="$1"
local make_folder="$2"
local url="$3"
shift 3
local opts="$@"
if [[ $url == "" ]]; then
error "Format: $0 <make folder?> <url> <optional args>\n"
return
fi
if [[ $format == "" ]]; then
printf "${BOLD}No format given; using best available.${NORMAL}\n"
# Download best mp4 video and best m4a audio, then merge.
# Download best mp4 video.
format="bv*[ext=mp4]+ba[ext=m4a]"
opts+=" --merge-output-format mp4"
fi
opts+=" --write-sub --sub-lang en --embed-subs"
# We're assuming we'll always have an mp4 video only and audio track to merge.
opts+=" --merge-output-format mp4 --write-subs --sub-lang en --embed-subs"
if [[ $make_folder == "1" ]]; then
make_vid_dir_and_cd_into $url ""
@@ -427,24 +423,40 @@ dl_youtube_vid_and_hflip() {
fi
fi
local filename=$(yt-dlp.exe --get-filename -f $format -o "%(upload_date>%Y-%m-%d)s-%(title)s-yt-%(id)s.%(ext)s" $url)
if [[ $shortname == "0" ]]; then
local name_format="%(upload_date>%Y-%m-%d)s-%(title)s-yt-%(id)s"
else
local name_format="%(upload_date>%Y-%m-%d)s-shortname-yt-%(id)s"
fi
# Get the video filename.
local filename=$(yt-dlp.exe --get-filename -f $format -o "$name_format.%(ext)s" $opts $url)
printf "filename: $filename\n"
# Download
local cmd="yt-dlp.exe -f $format -o \"$filename\" $opts $url"
eval $cmd # Need to eval in order to preserve the quotes wrapping the filename format string.
error=$?
if [[ $error -ne 0 ]]; then
error "Error: Failed to download '$url'"
if [[ $make_folder == "1" ]]; then cd ..; fi
return
fi
# Removing any trailing subtitle files
rm *.vtt *.srt 2>/dev/null
# Flip
ffmpeg -i "$filename" -vf hflip -c:a copy "copy_${filename}"
mv "copy_${filename}" "$filename"
if [[ $make_folder == "1" ]]; then
cd ..
if [[ $transcribe == "1" ]]; then
my_transcribe_video "$filename"
fi
if [[ $make_folder == "1" ]]; then cd ..; fi
printf "${BOLD}Finished downloading ${YELLOW}$filename${NORMAL}\n"
}
dl_youtube_playlist() {
download_youtube_playlist() {
local format="$1"
local url="$2"
local dir_name="$3"
@@ -452,9 +464,12 @@ dl_youtube_playlist() {
local opts="$@"
if [[ $url == "" ]]; then
error "Format: $0 <url> <directory name (optional)> <optional args>\n"
error "Usage: <url> <directory name (optional)> <optional args>"
return
fi
printf "${BOLD}Downloading Youtube playlist\n\n${NORMAL}"
if [[ $format == "" ]]; then
printf "${BOLD}No format given; using best available.${NORMAL}\n"
# Download best mp4 video and best m4a audio, then merge.
@@ -477,11 +492,60 @@ dl_youtube_playlist() {
# Removing any trailing subtitle files
rm *.vtt *.srt 2>/dev/null
cd ..
if [[ $dir_name == "1" ]]; then cd ..; fi
printf "${BOLD}Finished downloading the playlist\n${NORMAL}"
}
download_youtube_playlist_list() {
local url="$1"
local output_name="$2"
shift 2
local opts="$@"
if [[ $url == "" || $output_name == "" ]]; then
error "Usage: <url> <output name> <optional args>"
return
fi
printf "${BOLD}Downloading Youtube playlist video list\n\n${NORMAL}"
local cmd="yt-dlp.exe --ignore-errors -O \"%(playlist_index)s-%(title)s--%(id)s\" --skip-download $opts $url"
eval $cmd 1>"${output_name}.txt" # Need to eval in order to preserve the quotes wrapping the filename format string.
printf "${BOLD}Finished downloading the playlist video list\n${NORMAL}"
}
download_youtube_uploads_list() {
local include_descriptions="$1"
local url="$2"
local output_name="$3"
shift 3
local opts="$@"
if [[ $url == "" || $output_name == "" ]]; then
error "Usage: <url> <output name> <optional args>"
return
fi
local cmd=""
if [[ $include_descriptions == "1" ]]; then
printf "${BOLD}Downloading Youtube uploads list with descriptions\n\n${NORMAL}"
cmd="yt-dlp.exe --ignore-errors -O \"@@@ %(video_autonumber)s-%(upload_date>%Y-%m-%d)s--%(title)s--%(id)s\" --skip-download --get-description $opts $url"
else
printf "${BOLD}Downloading Youtube uploads list\n\n${NORMAL}"
cmd="yt-dlp.exe --ignore-errors -O \"%(video_autonumber)s-%(upload_date>%Y-%m-%d)s--%(title)s--%(id)s\" --skip-download $opts $url"
fi
eval $cmd 1>"${output_name}.txt" # Need to eval in order to preserve the quotes wrapping the filename format string.
printf "${BOLD}Finished downloading the upload list\n${NORMAL}"
}
# Download Twitch chat transcript
actually_dl_twitch_chat() {
actually_download_twitch_chat() {
local url="$1"
local filename="$2"
@@ -492,26 +556,31 @@ actually_dl_twitch_chat() {
else
error "Video doesn't have a chat transcript."
fi
printf "${BOLD}Finished downloading ${YELLOW}$filename${NORMAL}\n"
}
dl_twitch_chat() {
local url="$1"
shift 1
download_twitch_chat() {
local make_folder="$1"
local url="$2"
shift 2
local opts="$@"
if [[ $url == "" ]]; then
error "Format: $0 <url>\n"
error "Usage: <url>"
return
fi
if [[ $make_folder == "1" ]]; then
make_vid_dir_and_cd_into $url "" $opts
if [[ $? -ne 0 ]]; then
return
fi
fi
actually_dl_twitch_chat $url "$(yt-dlp.exe --get-filename -o "%(upload_date>%Y-%m-%d)s-%(title)s-tw-%(id)s" $opts $url)"
actually_download_twitch_chat $url "$(yt-dlp.exe --get-filename -o "%(upload_date>%Y-%m-%d)s-%(title)s-tw-%(id)s.chat" $opts $url)"
cd ..
if [[ $make_folder == "1" ]]; then cd ..; fi
}
# Download Twitch videos, both VODs and live streams. Pass a Twitch account URL to download a live stream.
@@ -525,17 +594,18 @@ dl_twitch_chat() {
# To extract a portion of a video, you have to first download the entire file and then use the
# `trim-video` or `compress-video-and-trim` scripts.
#
dl_twitch_vid() {
download_twitch_vid() {
local format="$1"
local shortname="$2"
local compress="$3"
local make_folder="$4"
local url="$5"
shift 5
local transcribe="$4"
local make_folder="$5"
local url="$6"
shift 6
local opts="$@"
if [[ $url == "" ]]; then
error "Format: $0 <make folder?> <url> <optional args>\n"
error "Usage: <make folder?> <url> <optional args>"
return
fi
@@ -550,10 +620,14 @@ dl_twitch_vid() {
printf "${BOLD}Subscriber VOD. Will use yt-dlp to download.${NORMAL}\n"
fi
if [[ $compress -eq 0 ]]; then
printf "${BOLD}Downloading Twitch vid with no compression.${NORMAL}\n"
if [[ $shortname == "1" || $compress == "1" || $transcribe == "1" ]]; then
printf "${BOLD}Downloading Twitch vid "
if [[ $shortname == "1" ]]; then printf "| ${YELLOW}using short name${NORMAL}${BOLD} "; fi
if [[ $compress == "1" ]]; then printf "| ${YELLOW}compression on${NORMAL}${BOLD} "; fi
if [[ $transcribe == "1" ]]; then printf "| ${YELLOW}audio transcription on${NORMAL}${BOLD} "; fi
printf "\n\n${NORMAL}"
else
printf "${BOLD}Downloading Twitch vid with compression.${NORMAL}\n"
printf "${BOLD}Downloading Twitch vid\n\n${NORMAL}"
fi
local yt_dlp_format=""
@@ -576,66 +650,82 @@ dl_twitch_vid() {
fi
fi
if [[ $shortname -eq 0 ]]; then
if [[ $shortname == "0" ]]; then
local name_format="%(upload_date>%Y-%m-%d)s-%(title)s-tw-%(id)s"
else
local name_format="%(upload_date>%Y-%m-%d)s-shortname-tw-%(id)s"
fi
# Download Twitch chat transcript
actually_dl_twitch_chat $url "$(yt-dlp.exe --get-filename -o "$name_format" $opts $url)"
actually_download_twitch_chat $url "$(yt-dlp.exe --get-filename -o "$name_format" $opts $url)"
# Get the video filename.
local filename=$(yt-dlp.exe --get-filename -o "$name_format.%(ext)s" $opts $url)
local filename=$(yt-dlp.exe --get-filename -f $yt_dlp_format -o "$name_format.%(ext)s" $opts $url)
# Download
if [[ $subscriber_vod -eq 0 ]]; then
if [[ $subscriber_vod == "0" ]]; then
local cmd="streamlink.exe --twitch-low-latency --twitch-disable-ads --twitch-disable-hosting --force --force-progress $opts $url $streamlink_format -O | ffmpeg -i pipe:0 -c copy \"$filename\""
else
local cmd="yt-dlp.exe -f $yt_dlp_format -o \"$filename\" $opts $url"
fi
printf "${YELLOW}${BOLD}Downloading video\n${NORMAL}"
eval $cmd # Need to eval in order to preserve the quotes wrapping the filename format string.
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"
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 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"
if [[ $error -ne 0 ]]; then
error "Error: Failed to download '$url'"
if [[ $make_folder == "1" ]]; then cd ..; fi
return
fi
if [[ $compress -eq 0 ]]; then
printf "${BOLD}Downloading Vimeo vid with no compression.${NORMAL}\n"
if [[ $compress == "1" ]]; then
local temp_name="temp_${RANDOM}"
# 0=cpu, 1=gpu
compress-video "$filename" "$temp_name" 0
extension="${filename##*.}"
mv "$filename" "orig_$filename"
mv $temp_name.$extension "$filename"
printf "${BOLD}Make sure to delete the original video file\n${NORMAL}"
fi
if [[ $transcribe == "1" ]]; then
my_transcribe_video "$filename"
fi
if [[ $make_folder == "1" ]]; then cd ..; fi
printf "${BOLD}Finished downloading ${YELLOW}$filename${NORMAL}\n"
}
# Download Vimeo videos.
# Can download an embedded vid. You might need to save the site cookies if the vid is behind a paywall.
# e.g. --cookies cookies.txt --referer https://gillyandkeeves.tv https://player.vimeo.com/video/756941969
# The vid ID can be found by looking at the embed's iframe src attribute.
download_vimeo_vid() {
local shortname="$1"
local compress="$2"
local transcribe="$3"
local format="$4"
local make_folder="$5"
local url="$6"
shift 5
local opts="$@"
if [[ $format == "" || $url == "" ]]; then
error "Usage: <format> <make folder?> <url> <optional args>"
return
fi
if [[ $shortname == "1" || $compress == "1" || $transcribe == "1" ]]; then
printf "${BOLD}Downloading Vimeo vid "
if [[ $shortname == "1" ]]; then printf "| ${YELLOW}using short name${NORMAL}${BOLD} "; fi
if [[ $compress == "1" ]]; then printf "| ${YELLOW}compression on${NORMAL}${BOLD} "; fi
if [[ $transcribe == "1" ]]; then printf "| ${YELLOW}audio transcription on${NORMAL}${BOLD} "; fi
printf "\n\n${NORMAL}"
else
printf "${BOLD}Downloading Vimeo vid with compression.${NORMAL}.\n"
printf "${BOLD}Downloading Vimeo vid\n\n${NORMAL}"
fi
if [[ $make_folder == "1" ]]; then
@@ -645,7 +735,7 @@ dl_vimeo_vid() {
fi
fi
if [[ $shortname -eq 0 ]]; then
if [[ $shortname == "0" ]]; then
local name_format="%(upload_date>%Y-%m-%d)s-%(title)s-vimeo-%(id)s"
else
local name_format="%(upload_date>%Y-%m-%d)s-shortname-vimeo-%(id)s"
@@ -659,31 +749,143 @@ dl_vimeo_vid() {
error=$?
if [[ $error -eq 0 ]]; then
if [[ $compress -eq 1 ]]; then
if [[ $compress == "1" ]]; then
local temp_name="temp_${RANDOM}"
# 1 arg = use GPU
compress-video 1 "$filename" "$temp_name"
# 0=cpu, 1=gpu
compress-video "$filename" "$temp_name" 0
extension="${filename##*.}"
mv "$filename" "orig_$filename"
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"
error "Error: Failed to download '$url'"
if [[ $make_folder == "1" ]]; then cd ..; fi
return
fi
if [[ $transcribe == "1" ]]; then
my_transcribe_video "$filename"
fi
if [[ $make_folder == "1" ]]; then cd ..; fi
printf "${BOLD}Finished downloading ${YELLOW}$filename${NORMAL}\n"
}
# Download Twitter videos.
download_twitter_vid() {
local format="$1"
local make_folder="$2"
local url="$3"
local vid_name="$4"
if [[ $url == "" ]]; then
error "Usage: <make folder?> <url> <optional filename> <optional args>"
return
fi
printf "${BOLD}Downloading Twitter vid.${NORMAL}\n"
if [[ $vid_name == "" ]]; then
local name_format="%(upload_date>%Y-%m-%d)s-%(title)s-twitter-%(id)s"
local opts=""
else
local name_format="%(upload_date>%Y-%m-%d)s-${vid_name}-twitter-%(id)s"
shift 4
local opts="$@"
fi
if [[ $make_folder == "1" ]]; then
cd ..
make_vid_dir_and_cd_into $url $vid_name $opts
if [[ $? -ne 0 ]]; then
return
fi
fi
if [[ $format == "" ]]; then
printf "${BOLD}No format given; using best available.${NORMAL}\n"
format="b"
fi
# Download the video.
local filename=$(yt-dlp.exe --get-filename -f $format -o "$name_format.%(ext)s" $opts $url)
local cmd="yt-dlp.exe -f $format -o \"$filename\" $opts $url"
eval $cmd # Need to eval in order to preserve the quotes wrapping the filename format string.
error=$?
if [[ $error -eq 1 ]]; then
error "Error: Failed to download '$url'"
fi
if [[ $make_folder == "1" ]]; then cd ..; fi
printf "${BOLD}Finished downloading ${YELLOW}$filename${NORMAL}\n"
}
# Download Instagram videos.
download_instagram_vid() {
local transcribe="$1"
local make_folder="$2"
local url="$3"
local vid_name="$4"
if [[ $url == "" ]]; then
error "Usage: <make folder?> <url> <optional filename> <optional args>"
return
fi
printf "${BOLD}Downloading Instagram vid.${NORMAL}\n"
if [[ $vid_name == "" ]]; then
local name_format="%(upload_date>%Y-%m-%d)s-%(title)s-ig-%(id)s"
local opts=""
else
local name_format="%(upload_date>%Y-%m-%d)s-${vid_name}-ig-%(id)s"
shift 4
local opts="$@"
fi
if [[ $make_folder == "1" ]]; then
make_vid_dir_and_cd_into $url $vid_name $opts
if [[ $? -ne 0 ]]; then
return
fi
fi
format="b" # best available
# Download the video.
local filename=$(yt-dlp.exe --get-filename -f $format -o "$name_format.%(ext)s" $opts $url)
local cmd="yt-dlp.exe -f $format -o \"$filename\" $opts $url"
eval $cmd # Need to eval in order to preserve the quotes wrapping the filename format string.
error=$?
if [[ $error -eq 1 ]]; then
error "Error: Failed to download '$url'"
if [[ $make_folder == "1" ]]; then cd ..; fi
return
fi
if [[ $transcribe == "1" ]]; then
transcribe "$filename"
fi
if [[ $make_folder == "1" ]]; then cd ..; fi
printf "${BOLD}Finished downloading ${YELLOW}$filename${NORMAL}\n"
}
# Download MP4 video.
dl_mp4() {
download_mp4() {
local url="$1"
local filename="$2"
if [[ $url == "" || $filename == "" ]]; then
error "Format: $0 <url> <filename>\n"
error "Usage: <url> <filename>"
return
fi
@@ -693,7 +895,7 @@ dl_mp4() {
curl "$url" -o $temp_name
if [[ $? -ne 0 ]]; then
error "Error: failed to download.\n"
error "Error: failed to download."
return
fi
@@ -701,12 +903,12 @@ dl_mp4() {
}
# Download from m3u8 stream to mp4.
dl_from_m3u8() {
download_from_m3u8() {
local m3u8_path="$1"
local filename="$2"
if [[ $m3u8_path == "" || $filename == "" ]]; then
error "Format: $0 <m3u8 path> <filename>\n"
error "Usage: <m3u8 path> <filename>"
return
fi
@@ -714,99 +916,138 @@ dl_from_m3u8() {
ffmpeg.exe -protocol_whitelist file,https,crypto,tls,tcp -i $m3u8_path -acodec copy -vcodec copy "${filename}.mp4"
if [[ $? -ne 0 ]]; then
error "Error: failed to download.\n"
error "Error: failed to download."
return
fi
printf "${BOLD}Finished downloading ${YELLOW}$filename${NORMAL}\n"
}
# Download Instagram video and flip horizontally.
dl_instagram_vid_and_hflip() {
local url="$1"
local filename="$2"
if [[ $url == "" || $filename == "" ]]; then
error "Format: $0 <url> <filename>\n"
return
fi
temp_name="temp_${RANDOM}.mp4"
printf "${BOLD}Downloading: ${YELLOW}$filename${NORMAL}\n"
curl "$url" -o $temp_name
if [[ $? -ne 0 ]]; then
error "Error: failed to download.\n"
return
fi
# Flip
ffmpeg -i $temp_name -vf hflip -c:a copy "copy_$temp_name"
mv copy_${temp_name} "$filename.mp4"
rm $temp_name
}
#-------------------------------------------------
# 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-list='download_youtube_uploads_list 0 '
alias yt-list-desc='download_youtube_uploads_list 1 '
alias yt-playlist='dl_youtube_playlist ""'
alias yt-playlist-1080='dl_youtube_playlist "137+140"'
alias yt-playlist-720='dl_youtube_playlist "136+140"'
alias yt-playlist-tiny='dl_youtube_playlist "160+140"'
alias yt='download_youtube_vid "" $SHORTNAME_OFF $TRANSCRIBE_OFF'
alias yt-shortname='download_youtube_vid "" $SHORTNAME_ON $TRANSCRIBE_OFF'
alias yt-1080='download_youtube_vid "137+140" $SHORTNAME_OFF $TRANSCRIBE_OFF'
alias yt-1080-shortname='download_youtube_vid "137+140" $SHORTNAME_ON $TRANSCRIBE_OFF'
alias yt-720='download_youtube_vid "136+140" $SHORTNAME_OFF $TRANSCRIBE_OFF'
alias yt-720-shortname='download_youtube_vid "136+140" $SHORTNAME_ON $TRANSCRIBE_OFF'
#TRANSCRIPTION ON
alias ytt='download_youtube_vid "" $SHORTNAME_OFF $TRANSCRIBE_ON'
alias yt-shortname-t='download_youtube_vid "" $SHORTNAME_ON $TRANSCRIBE_ON'
alias yt-1080-t='download_youtube_vid "137+140" $SHORTNAME_OFF $TRANSCRIBE_ON'
alias yt-1080-shortname-t='download_youtube_vid "137+140" $SHORTNAME_ON $TRANSCRIBE_ON'
alias yt-720-t='download_youtube_vid "136+140" $SHORTNAME_OFF $TRANSCRIBE_ON'
alias yt-720-shortname-t='download_youtube_vid "136+140" $SHORTNAME_ON $TRANSCRIBE_ON'
#---------------------------
alias yt-playlist='download_youtube_playlist ""'
alias yt-playlist-list='download_youtube_playlist_list '
alias yt-playlist-1080='download_youtube_playlist "137+140"'
alias yt-playlist-720='download_youtube_playlist "136+140"'
alias yt-playlist-tiny='download_youtube_playlist "160+140"'
alias yt-audio='yt-dlp.exe -f "140"'
alias yt-and-hflip='dl_youtube_vid_and_hflip "137+140"' # 1080p
#-------------------------------------------------
# Twitch Vid DL
alias tw='dl_twitch_vid "" $SHORTNAME_OFF $COMPRESSION_OFF'
alias tw-compressed='dl_twitch_vid "" $SHORTNAME_OFF $COMPRESSION_ON'
alias tw-shortname='dl_twitch_vid "" $SHORTNAME_ON $COMPRESSION_OFF'
alias tw-shortname-compressed='dl_twitch_vid "" $SHORTNAME_ON $COMPRESSION_ON'
alias tw-custom='dl_twitch_vid '
alias tw-chat='dl_twitch_chat'
#-------------------------------------------------
alias tw-chat='download_twitch_chat'
alias tw-1080='dl_twitch_vid "1080" $SHORTNAME_OFF $COMPRESSION_OFF'
alias tw-1080-compressed='dl_twitch_vid "1080" $SHORTNAME_OFF $COMPRESSION_ON'
alias tw-1080-shortname='dl_twitch_vid "1080" $SHORTNAME_ON $COMPRESSION_OFF'
alias tw-1080-shortname-compressed='dl_twitch_vid "1080" $SHORTNAME_ON $COMPRESSION_ON'
alias tw='download_twitch_vid "" $SHORTNAME_OFF $COMPRESSION_OFF $TRANSCRIBE_OFF'
alias tw-compressed='download_twitch_vid "" $SHORTNAME_OFF $COMPRESSION_ON $TRANSCRIBE_OFF'
alias tw-shortname='download_twitch_vid "" $SHORTNAME_ON $COMPRESSION_OFF $TRANSCRIBE_OFF'
alias tw-shortname-compressed='download_twitch_vid "" $SHORTNAME_ON $COMPRESSION_ON $TRANSCRIBE_OFF'
alias tw-source='download_twitch_vid "Source" $SHORTNAME_OFF $COMPRESSION_ON $TRANSCRIBE_OFF'
alias tw-custom='download_twitch_vid '
#TRANSCRIPTION ON
alias twt='download_twitch_vid "" $SHORTNAME_OFF $COMPRESSION_OFF $TRANSCRIBE_ON'
alias tw-compressed-t='download_twitch_vid "" $SHORTNAME_OFF $COMPRESSION_ON $TRANSCRIBE_ON'
alias tw-shortname-t='download_twitch_vid "" $SHORTNAME_ON $COMPRESSION_OFF $TRANSCRIBE_ON'
alias tw-shortname-compressed-t='download_twitch_vid "" $SHORTNAME_ON $COMPRESSION_ON $TRANSCRIBE_ON'
alias tw-source-t='download_twitch_vid "Source" "Source" $SHORTNAME_OFF $COMPRESSION_ON $TRANSCRIBE_ON'
alias tw-1080p60='dl_twitch_vid "1080p60" $SHORTNAME_OFF $COMPRESSION_OFF'
alias tw-1080p50='dl_twitch_vid "1080p50" $SHORTNAME_OFF $COMPRESSION_OFF'
alias tw-1080p60-compressed='dl_twitch_vid "1080p60" $SHORTNAME_OFF $COMPRESSION_ON'
alias tw-1080p50-compressed='dl_twitch_vid "1080p50" $SHORTNAME_OFF $COMPRESSION_ON'
alias tw-1080p60-shortname='dl_twitch_vid "1080p60" $SHORTNAME_ON $COMPRESSION_OFF'
alias tw-1080p50-shortname='dl_twitch_vid "1080p50" $SHORTNAME_ON $COMPRESSION_OFF'
alias tw-1080p60-shortname-compressed='dl_twitch_vid "1080p60" $SHORTNAME_ON $COMPRESSION_ON'
alias tw-1080p50-shortname-compressed='dl_twitch_vid "1080p50" $SHORTNAME_ON $COMPRESSION_ON'
#1080p
alias tw-1080='download_twitch_vid "1080" $SHORTNAME_OFF $COMPRESSION_ON $TRANSCRIBE_OFF'
alias tw-1080-compressed='download_twitch_vid "1080" $SHORTNAME_OFF $COMPRESSION_ON $TRANSCRIBE_OFF'
alias tw-1080-shortname='download_twitch_vid "1080" $SHORTNAME_ON $COMPRESSION_ON $TRANSCRIBE_OFF'
alias tw-1080-shortname-compressed='download_twitch_vid "1080" $SHORTNAME_ON $COMPRESSION_ON $TRANSCRIBE_OFF'
#TRANSCRIPTION ON
alias tw-1080-t='download_twitch_vid "1080" $SHORTNAME_OFF $COMPRESSION_ON $TRANSCRIBE_ON'
alias tw-1080-compressed-t='download_twitch_vid "1080" $SHORTNAME_OFF $COMPRESSION_ON $TRANSCRIBE_ON'
alias tw-1080-shortname-t='download_twitch_vid "1080" $SHORTNAME_ON $COMPRESSION_ON $TRANSCRIBE_ON'
alias tw-1080-shortname-compressed-t='download_twitch_vid "1080" $SHORTNAME_ON $COMPRESSION_ON $TRANSCRIBE_ON'
alias tw-720='dl_twitch_vid "720p" $SHORTNAME_OFF $COMPRESSION_OFF'
alias tw-720-compressed='dl_twitch_vid "720p" $SHORTNAME_OFF $COMPRESSION_ON'
alias tw-720-shortname='dl_twitch_vid "720p" $SHORTNAME_ON $COMPRESSION_OFF'
alias tw-720p60='dl_twitch_vid "720p60" $SHORTNAME_OFF $COMPRESSION_OFF'
alias tw-720p60-shortname='dl_twitch_vid "720p60" $SHORTNAME_ON $COMPRESSION_OFF'
#1080p60/50
alias tw-1080p60='download_twitch_vid "1080p60" $SHORTNAME_OFF $COMPRESSION_ON $TRANSCRIBE_OFF'
alias tw-1080p50='download_twitch_vid "1080p50" $SHORTNAME_OFF $COMPRESSION_ON $TRANSCRIBE_OFF'
alias tw-1080p60-compressed='download_twitch_vid "1080p60" $SHORTNAME_OFF $COMPRESSION_ON $TRANSCRIBE_OFF'
alias tw-1080p50-compressed='download_twitch_vid "1080p50" $SHORTNAME_OFF $COMPRESSION_ON $TRANSCRIBE_OFF'
alias tw-1080p60-shortname='download_twitch_vid "1080p60" $SHORTNAME_ON $COMPRESSION_ON $TRANSCRIBE_OFF'
alias tw-1080p50-shortname='download_twitch_vid "1080p50" $SHORTNAME_ON $COMPRESSION_ON $TRANSCRIBE_OFF'
alias tw-1080p60-shortname-compressed='download_twitch_vid "1080p60" $SHORTNAME_ON $COMPRESSION_ON $TRANSCRIBE_OFF'
alias tw-1080p50-shortname-compressed='download_twitch_vid "1080p50" $SHORTNAME_ON $COMPRESSION_ON $TRANSCRIBE_OFF'
#TRANSCRIPTION ON
alias tw-1080p60-t='download_twitch_vid "1080p60" $SHORTNAME_OFF $COMPRESSION_ON $TRANSCRIBE_ON'
alias tw-1080p50-t='download_twitch_vid "1080p50" $SHORTNAME_OFF $COMPRESSION_ON $TRANSCRIBE_ON'
alias tw-1080p60-compressed-t='download_twitch_vid "1080p60" $SHORTNAME_OFF $COMPRESSION_ON $TRANSCRIBE_ON'
alias tw-1080p50-compressed-t='download_twitch_vid "1080p50" $SHORTNAME_OFF $COMPRESSION_ON $TRANSCRIBE_ON'
alias tw-1080p60-shortname-t='download_twitch_vid "1080p60" $SHORTNAME_ON $COMPRESSION_ON $TRANSCRIBE_ON'
alias tw-1080p50-shortname-t='download_twitch_vid "1080p50" $SHORTNAME_ON $COMPRESSION_ON $TRANSCRIBE_ON'
alias tw-1080p60-shortname-compressed-t='download_twitch_vid "1080p60" $SHORTNAME_ON $COMPRESSION_ON $TRANSCRIBE_ON'
alias tw-1080p50-shortname-compressed-t='download_twitch_vid "1080p50" $SHORTNAME_ON $COMPRESSION_ON $TRANSCRIBE_ON'
alias tw-4k='dl_twitch_vid "2160p" $SHORTNAME_OFF $COMPRESSION_OFF'
alias tw-4k-compressed='dl_twitch_vid "2160p" $SHORTNAME_OFF $COMPRESSION_ON'
alias tw-4k-shortname='dl_twitch_vid "2160p" $SHORTNAME_ON $COMPRESSION_OFF'
alias tw-4k-shortname-compressed='dl_twitch_vid "2160p" $SHORTNAME_ON $COMPRESSION_ON'
#720p
alias tw-720='download_twitch_vid "720p" $SHORTNAME_OFF $COMPRESSION_ON $TRANSCRIBE_OFF'
alias tw-720-compressed='download_twitch_vid "720p" $SHORTNAME_OFF $COMPRESSION_ON $TRANSCRIBE_OFF'
alias tw-720-shortname='download_twitch_vid "720p" $SHORTNAME_ON $COMPRESSION_ON $TRANSCRIBE_OFF'
alias tw-720p60='download_twitch_vid "720p60" $SHORTNAME_OFF $COMPRESSION_ON $TRANSCRIBE_OFF'
alias tw-720p60-shortname='download_twitch_vid "720p60" $SHORTNAME_ON $COMPRESSION_ON $TRANSCRIBE_OFF'
#TRANSCRIPTION ON
alias tw-720-t='download_twitch_vid "720p" $SHORTNAME_OFF $COMPRESSION_ON $TRANSCRIBE_ON'
alias tw-720-compressed-t='download_twitch_vid "720p" $SHORTNAME_OFF $COMPRESSION_ON $TRANSCRIBE_ON'
alias tw-720-shortname-t='download_twitch_vid "720p" $SHORTNAME_ON $COMPRESSION_ON $TRANSCRIBE_ON'
alias tw-720p60-t='download_twitch_vid "720p60" $SHORTNAME_OFF $COMPRESSION_ON $TRANSCRIBE_ON'
alias tw-720p60-shortname-t='download_twitch_vid "720p60" $SHORTNAME_ON $COMPRESSION_ON $TRANSCRIBE_ON'
alias tw-source='dl_twitch_vid "Source" $SHORTNAME_OFF $COMPRESSION_OFF'
#4k
alias tw-4k='download_twitch_vid "2160p" $SHORTNAME_OFF $COMPRESSION_ON $TRANSCRIBE_OFF'
alias tw-4k-compressed='download_twitch_vid "2160p" $SHORTNAME_OFF $COMPRESSION_ON $TRANSCRIBE_OFF'
alias tw-4k-shortname='download_twitch_vid "2160p" $SHORTNAME_ON $COMPRESSION_ON $TRANSCRIBE_OFF'
alias tw-4k-shortname-compressed='download_twitch_vid "2160p" $SHORTNAME_ON $COMPRESSION_ON $TRANSCRIBE_OFF'
#TRANSCRIPTION ON
alias tw-4k-t='download_twitch_vid "2160p" $SHORTNAME_OFF $COMPRESSION_ON $TRANSCRIBE_ON'
alias tw-4k-compressed-t='download_twitch_vid "2160p" $SHORTNAME_OFF $COMPRESSION_ON $TRANSCRIBE_ON'
alias tw-4k-shortname-t='download_twitch_vid "2160p" $SHORTNAME_ON $COMPRESSION_ON $TRANSCRIBE_ON'
alias tw-4k-shortname-compressed-t='download_twitch_vi "2160p" $SHORTNAME_ON $COMPRESSION_ON $TRANSCRIBE_ON'
#-------------------------------------------------
# Vimeo Vid DL
alias vimeo='dl_vimeo_vid "Original" $SHORTNAME_OFF $COMPRESSION_OFF'
alias vimeo-compressed='dl_vimeo_vid "Original" $SHORTNAME_OFF $COMPRESSION_ON'
#-------------------------------------------------
alias vimeo='download_vimeo_vid $SHORTNAME_OFF $COMPRESSION_ON $TRANSCRIBE_OFF'
alias vimeo-t='download_vimeo_vid $SHORTNAME_OFF $COMPRESSION_ON $TRANSCRIBE_ON'
alias vimeo-compressed='download_vimeo_vid $SHORTNAME_OFF $COMPRESSION_ON $TRANSCRIBE_OFF'
alias vimeo-compressed-t='download_vimeo_vid $SHORTNAME_OFF $COMPRESSION_ON $TRANSCRIBE_ON'
#-------------------------------------------------
# Instagram Vid DL
alias ig-download-and-hflip='dl_instagram_vid_and_hflip '
#-------------------------------------------------
alias ig='download_instagram_vid $TRANSCRIBE_OFF'
alias igt='download_instagram_vid $TRANSCRIBE_ON'
#-------------------------------------------------
# Twitter Vid DL
#-------------------------------------------------
alias twitter='download_twitter_vid "" '
#-------------------------------------------------
# Misc
alias download-mp4='dl_mp4'
alias download-from-m3u8='dl_from_m3u8'
#-------------------------------------------------
alias download-mp4='download_mp4'
alias download-from-m3u8='download_from_m3u8'
####################################################################################################
# Video Compression
@@ -817,11 +1058,11 @@ function _compress_video_hard() {
local name="$1"
local out="$2"
if [[ name == "" || out == "" ]]; then
error "Format: cmd <source> <dest>\n"
error "Usage: cmd <source> <dest>"
return
fi
# 1 arg = use GPU
compress-video-with-crf 1 $crf "$name" "$out"
# 0=cpu, 1=gpu
compress-video-with-crf $crf "$name" "$out" 0
}
alias compress-video-hard='_compress_video_hard'
@@ -895,7 +1136,7 @@ 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 gbdr='git branch -Dr' # Delete a remote tracking branch; useful when the remote no longer exists and branch pruning isn't removing the lingering tracking branches.
alias gbg='git bisect good'
alias gbl='git branch --all'
alias gblm='git blame -wMC'
@@ -944,6 +1185,7 @@ alias gmffs='git merge --ff-only --squash'
alias gmtheirs='git merge -Xtheirs'
alias gp='git push'
alias gpa='git push --all && echo "pushing tags..." && git push --tags'
alias gpaf='git push --all -f && echo "pushing tags..." && git push --tags -f'
alias gpf='git push -f'
alias gpff='git pull --ff-only'
alias gplu='git pull --set-upstream origin HEAD'
@@ -995,10 +1237,11 @@ alias gsp3='git stash pop stash@{3}'
alias gsp4='git stash pop stash@{4}'
alias gsp5='git stash pop stash@{6}'
alias gsp6='git stash pop stash@{7}'
alias gt='git tag -s' # Signed
alias gt='git tag' # Unsigned
alias gta='git tag -a'
alias gtd='git tag -d'
alias gtl='git tag -l'
alias gts='git tag -s' # Signed
alias gx='git reset --hard'
alias gxx='git reset --hard HEAD~1'
alias gxom='git reset --hard origin/master'
@@ -1008,8 +1251,8 @@ alias gwip="git add . && git commit -m \"WIP\""
####################################################################################################
# Elixir
####################################################################################################
alias iex='rlwrap iex'
alias iexw='rlwrap iex --werl'
alias iex='rlwrap -i -f ~/.iex_history -H ~/.iex_history -s 30000 iex'
alias iexw='rlwrap -i -f ~/.iex_history -H ~/.iex_history -s 30000 iex --werl'
alias ep='iex -S mix phx.server'
alias ei='iex -S mix'
alias er='mix phx.server'

View File

@@ -30,7 +30,7 @@ parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
fi
}
export PS1='\[\033[0;32m\]\[\033[0m\033[0;32m\]\u\[\033[0;36m\] @ \w\[\033[33m\]\n$(parse_git_branch)\[\033[0;32m\]\[\033[0m\033[0;32m\] \$\[\033[0m\033[0;32m\]\[\033[0m\] '
export PS1='\[\033[0;32m\]\[\033[0m\033[0;32m\]\u\[\033[0;36m\] -> \w\[\033[33m\]\n$(parse_git_branch)\[\033[0;32m\]\[\033[0m\033[0;32m\] \$\[\033[0m\033[0;32m\]\[\033[0m\] '
# Git autocompletion.
if [ -f ~/.git-completion.bash ]; then

View File

View File

@@ -13,16 +13,20 @@ esac
export PLATFORM=$platform
export PLATFORM_OS=$platform_os
test -f "$HOME/.env.platform" && . "$HOME/.env.platform"
os_lower="${platform_os,,}"
test -f "$HOME/dotfiles/${os_lower}/env.platform" && . "$HOME/dotfiles/${os_lower}/env.platform"
test -f "$HOME/.env.common-pre" && . "$HOME/.env.common-pre"
test -f "$HOME/.env.private" && . "$HOME/.env.private"
test -f "$HOME/.env.common-post" && . "$HOME/.env.common-post"
test -f "$HOME/.aliases" && . "$HOME/.aliases"
test -f "$HOME/.aliases.common" && . "$HOME/.aliases.common"
test -f "$HOME/.aliases.private" && . "$HOME/.aliases.private"
if [[ $_MC_SET_ENV_PATH -ne 1 ]]; then
test -d "$HOME/bin" && export PATH=$HOME/bin/:$PATH
#TODO: remove this
test -d "$HOME/.dotfiles/bin" && export PATH=$HOME/.dotfiles/bin/:$PATH
fi

5
.gitattributes vendored Normal file
View File

@@ -0,0 +1,5 @@
# All text files will have LF line endings, except batch files.
* text=auto
# Preserve crlf in batch files when checking in.
*.bat text eol=crlf

View File

@@ -1,5 +1,4 @@
[include]
path = ~/.gitconfig.platform
path = ~/.gitconfig.private
[init]
defaultBranch = master
@@ -7,10 +6,25 @@
summary = true
tool = vimdiff
[core]
excludesfile = ~/.gitignore
excludesfile = ~/.gitignore.global
hookspath = ~/.git_hooks
preloadindex = true
fscache = true
editor = vim
# I used to have this set to true, which would result in checked out files
# being converted to CRLF line endings and commits converting to LF. I'm
# tired of this conversion shit though so I'm turning it off and will be
# enforcing LF line endings via a combination of editorconfig and
# gitattribute files on a per-project basis. This should make sure that
# anyone contributing to my projects will be committing LF line endings.
# The only exception is that the gitattributes files will commit batch
# files with CRLF to avoid Windows glitches.
#
# I used these posts for reference:
# https://markentier.tech/posts/2021/10/autocrlf-true-considered-harmful/
# https://troyready.com/blog/git-windows-dont-convert-line-endings.html
#
autocrlf = false
[push]
default = upstream
[pull]

9
.gitignore vendored
View File

@@ -1,8 +1 @@
vim/.netrwhist
vim/bundle/*
vim/plugged/*
vim/undo
vim/undo/*
config/openbox/lxde-rc.xml
*.pyc
!bin
*

3
.gitmodules vendored
View File

@@ -1,3 +0,0 @@
[submodule "vim/bundle/Vundle.vim"]
path = vim/bundle/Vundle.vim
url = https://github.com/VundleVim/Vundle.vim.git

View File

@@ -25,7 +25,7 @@
" Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' }
" Plug 'tpope/vim-fireplace', { 'for': 'clojure' }
"
" " Using a non-master branch
" " Using a non-default branch
" Plug 'rdnetto/YCM-Generator', { 'branch': 'stable' }
"
" " Using a tagged release; wildcard allowed (requires git 1.9.2 or above)
@@ -106,7 +106,7 @@ if s:is_win && &shellslash
else
let s:me = resolve(expand('<sfile>:p'))
endif
let s:base_spec = { 'branch': 'master', 'frozen': 0 }
let s:base_spec = { 'branch': '', 'frozen': 0 }
let s:TYPE = {
\ 'string': type(''),
\ 'list': type([]),
@@ -116,6 +116,94 @@ let s:TYPE = {
let s:loaded = get(s:, 'loaded', {})
let s:triggers = get(s:, 'triggers', {})
function! s:is_powershell(shell)
return a:shell =~# 'powershell\(\.exe\)\?$' || a:shell =~# 'pwsh\(\.exe\)\?$'
endfunction
function! s:isabsolute(dir) abort
return a:dir =~# '^/' || (has('win32') && a:dir =~? '^\%(\\\|[A-Z]:\)')
endfunction
function! s:git_dir(dir) abort
let gitdir = s:trim(a:dir) . '/.git'
if isdirectory(gitdir)
return gitdir
endif
if !filereadable(gitdir)
return ''
endif
let gitdir = matchstr(get(readfile(gitdir), 0, ''), '^gitdir: \zs.*')
if len(gitdir) && !s:isabsolute(gitdir)
let gitdir = a:dir . '/' . gitdir
endif
return isdirectory(gitdir) ? gitdir : ''
endfunction
function! s:git_origin_url(dir) abort
let gitdir = s:git_dir(a:dir)
let config = gitdir . '/config'
if empty(gitdir) || !filereadable(config)
return ''
endif
return matchstr(join(readfile(config)), '\[remote "origin"\].\{-}url\s*=\s*\zs\S*\ze')
endfunction
function! s:git_revision(dir) abort
let gitdir = s:git_dir(a:dir)
let head = gitdir . '/HEAD'
if empty(gitdir) || !filereadable(head)
return ''
endif
let line = get(readfile(head), 0, '')
let ref = matchstr(line, '^ref: \zs.*')
if empty(ref)
return line
endif
if filereadable(gitdir . '/' . ref)
return get(readfile(gitdir . '/' . ref), 0, '')
endif
if filereadable(gitdir . '/packed-refs')
for line in readfile(gitdir . '/packed-refs')
if line =~# ' ' . ref
return matchstr(line, '^[0-9a-f]*')
endif
endfor
endif
return ''
endfunction
function! s:git_local_branch(dir) abort
let gitdir = s:git_dir(a:dir)
let head = gitdir . '/HEAD'
if empty(gitdir) || !filereadable(head)
return ''
endif
let branch = matchstr(get(readfile(head), 0, ''), '^ref: refs/heads/\zs.*')
return len(branch) ? branch : 'HEAD'
endfunction
function! s:git_origin_branch(spec)
if len(a:spec.branch)
return a:spec.branch
endif
" The file may not be present if this is a local repository
let gitdir = s:git_dir(a:spec.dir)
let origin_head = gitdir.'/refs/remotes/origin/HEAD'
if len(gitdir) && filereadable(origin_head)
return matchstr(get(readfile(origin_head), 0, ''),
\ '^ref: refs/remotes/origin/\zs.*')
endif
" The command may not return the name of a branch in detached HEAD state
let result = s:lines(s:system('git symbolic-ref --short HEAD', a:spec.dir))
return v:shell_error ? '' : result[-1]
endfunction
if s:is_win
function! s:plug_call(fn, ...)
let shellslash = &shellslash
@@ -154,6 +242,8 @@ function! plug#begin(...)
let home = s:path(s:plug_fnamemodify(s:plug_expand(a:1), ':p'))
elseif exists('g:plug_home')
let home = s:path(g:plug_home)
elseif has('nvim')
let home = stdpath('data') . '/plugged'
elseif !empty(&rtp)
let home = s:path(split(&rtp, ',')[0]) . '/plugged'
else
@@ -179,7 +269,7 @@ function! s:define_commands()
endif
if has('win32')
\ && &shellslash
\ && (&shell =~# 'cmd\(\.exe\)\?$' || &shell =~# 'powershell\(\.exe\)\?$')
\ && (&shell =~# 'cmd\(\.exe\)\?$' || s:is_powershell(&shell))
return s:err('vim-plug does not support shell, ' . &shell . ', when shellslash is set.')
endif
if !has('nvim')
@@ -262,7 +352,7 @@ function! plug#end()
endif
let lod = { 'ft': {}, 'map': {}, 'cmd': {} }
if exists('g:did_load_filetypes')
if get(g:, 'did_load_filetypes', 0)
filetype off
endif
for name in g:plugs_order
@@ -317,7 +407,7 @@ function! plug#end()
for [map, names] in items(lod.map)
for [mode, map_prefix, key_prefix] in
\ [['i', '<C-O>', ''], ['n', '', ''], ['v', '', 'gv'], ['o', '', '']]
\ [['i', '<C-\><C-O>', ''], ['n', '', ''], ['v', '', 'gv'], ['o', '', '']]
execute printf(
\ '%snoremap <silent> %s %s:<C-U>call <SID>lod_map(%s, %s, %s, "%s")<CR>',
\ mode, map, map_prefix, string(map), string(names), mode != 'i', key_prefix)
@@ -419,7 +509,7 @@ if s:is_win
let batchfile = s:plug_tempname().'.bat'
call writefile(s:wrap_cmds(a:cmd), batchfile)
let cmd = plug#shellescape(batchfile, {'shell': &shell, 'script': 0})
if &shell =~# 'powershell\(\.exe\)\?$'
if s:is_powershell(&shell)
let cmd = '& ' . cmd
endif
return [batchfile, cmd]
@@ -646,25 +736,25 @@ function! s:parse_options(arg)
endif
let opts.tag = a:arg
elseif type == s:TYPE.dict
call extend(opts, a:arg)
for opt in ['branch', 'tag', 'commit', 'rtp', 'dir', 'as']
if has_key(opts, opt)
\ && (type(opts[opt]) != s:TYPE.string || empty(opts[opt]))
if has_key(a:arg, opt)
\ && (type(a:arg[opt]) != s:TYPE.string || empty(a:arg[opt]))
throw printf(opt_errfmt, opt, 'string')
endif
endfor
for opt in ['on', 'for']
if has_key(opts, opt)
\ && type(opts[opt]) != s:TYPE.list
\ && (type(opts[opt]) != s:TYPE.string || empty(opts[opt]))
if has_key(a:arg, opt)
\ && type(a:arg[opt]) != s:TYPE.list
\ && (type(a:arg[opt]) != s:TYPE.string || empty(a:arg[opt]))
throw printf(opt_errfmt, opt, 'string or list')
endif
endfor
if has_key(opts, 'do')
\ && type(opts.do) != s:TYPE.funcref
\ && (type(opts.do) != s:TYPE.string || empty(opts.do))
if has_key(a:arg, 'do')
\ && type(a:arg.do) != s:TYPE.funcref
\ && (type(a:arg.do) != s:TYPE.string || empty(a:arg.do))
throw printf(opt_errfmt, 'do', 'string or funcref')
endif
call extend(opts, a:arg)
if has_key(opts, 'dir')
let opts.dir = s:dirpath(s:plug_expand(opts.dir))
endif
@@ -720,7 +810,7 @@ function! s:syntax()
syn match plugNumber /[0-9]\+[0-9.]*/ contained
syn match plugBracket /[[\]]/ contained
syn match plugX /x/ contained
syn match plugDash /^-/
syn match plugDash /^-\{1}\ /
syn match plugPlus /^+/
syn match plugStar /^*/
syn match plugMessage /\(^- \)\@<=.*/
@@ -738,6 +828,7 @@ function! s:syntax()
syn match plugError /^x.*/
syn region plugDeleted start=/^\~ .*/ end=/^\ze\S/
syn match plugH2 /^.*:\n-\+$/
syn match plugH2 /^-\{2,}/
syn keyword Function PlugInstall PlugStatus PlugUpdate PlugClean
hi def link plug1 Title
hi def link plug2 Repeat
@@ -850,7 +941,7 @@ function! s:prepare(...)
call s:new_window()
endif
nnoremap <silent> <buffer> q :if b:plug_preview==1<bar>pc<bar>endif<bar>bd<cr>
nnoremap <silent> <buffer> q :call <SID>close_pane()<cr>
if a:0 == 0
call s:finish_bindings()
endif
@@ -872,6 +963,15 @@ function! s:prepare(...)
endif
endfunction
function! s:close_pane()
if b:plug_preview == 1
pc
let b:plug_preview = -1
else
bd
endif
endfunction
function! s:assign_name()
" Assign buffer name
let prefix = '[Plugins]'
@@ -890,7 +990,7 @@ function! s:chsh(swap)
set shell=sh
endif
if a:swap
if &shell =~# 'powershell\(\.exe\)\?$' || &shell =~# 'pwsh$'
if s:is_powershell(&shell)
let &shellredir = '2>&1 | Out-File -Encoding UTF8 %s'
elseif &shell =~# 'sh' || &shell =~# 'cmd\(\.exe\)\?$'
set shellredir=>%s\ 2>&1
@@ -991,10 +1091,11 @@ endfunction
function! s:checkout(spec)
let sha = a:spec.commit
let output = s:system(['git', 'rev-parse', 'HEAD'], a:spec.dir)
if !v:shell_error && !s:hash_match(sha, s:lines(output)[0])
let output = s:git_revision(a:spec.dir)
if !empty(output) && !s:hash_match(sha, s:lines(output)[0])
let credential_helper = s:git_version_requirement(2) ? '-c credential.helper= ' : ''
let output = s:system(
\ 'git fetch --depth 999999 && git checkout '.plug#shellescape(sha).' --', a:spec.dir)
\ 'git '.credential_helper.'fetch --depth 999999 && git checkout '.plug#shellescape(sha).' --', a:spec.dir)
endif
return output
endfunction
@@ -1109,7 +1210,8 @@ function! s:update_impl(pull, force, args) abort
normal! 2G
silent! redraw
let s:clone_opt = []
" Set remote name, overriding a possible user git config's clone.defaultRemoteName
let s:clone_opt = ['--origin', 'origin']
if get(g:, 'plug_shallow', 1)
call extend(s:clone_opt, ['--depth', '1'])
if s:git_version_requirement(1, 7, 10)
@@ -1206,7 +1308,7 @@ function! s:update_finish()
call s:log4(name, 'Checking out '.tag)
let out = s:system('git checkout -q '.plug#shellescape(tag).' -- 2>&1', spec.dir)
else
let branch = get(spec, 'branch', 'master')
let branch = s:git_origin_branch(spec)
call s:log4(name, 'Merging origin/'.s:esc(branch))
let out = s:system('git checkout -q '.plug#shellescape(branch).' -- 2>&1'
\. (has_key(s:update.new, name) ? '' : ('&& git merge --ff-only '.plug#shellescape('origin/'.branch).' 2>&1')), spec.dir)
@@ -1446,7 +1548,7 @@ while 1 " Without TCO, Vim stack is bound to explode
let [error, _] = s:git_validate(spec, 0)
if empty(error)
if pull
let cmd = ['git', 'fetch']
let cmd = s:git_version_requirement(2) ? ['git', '-c', 'credential.helper=', 'fetch'] : ['git', 'fetch']
if has_tag && !empty(globpath(spec.dir, '.git/shallow'))
call extend(cmd, ['--depth', '99999999'])
endif
@@ -2130,7 +2232,7 @@ function! plug#shellescape(arg, ...)
let script = get(opts, 'script', 1)
if shell =~# 'cmd\(\.exe\)\?$'
return s:shellesc_cmd(a:arg, script)
elseif shell =~# 'powershell\(\.exe\)\?$' || shell =~# 'pwsh$'
elseif s:is_powershell(shell)
return s:shellesc_ps1(a:arg)
endif
return s:shellesc_sh(a:arg)
@@ -2182,7 +2284,7 @@ function! s:system(cmd, ...)
return system(a:cmd)
endif
let cmd = join(map(copy(a:cmd), 'plug#shellescape(v:val, {"shell": &shell, "script": 0})'))
if &shell =~# 'powershell\(\.exe\)\?$'
if s:is_powershell(&shell)
let cmd = '& ' . cmd
endif
else
@@ -2211,18 +2313,17 @@ endfunction
function! s:git_validate(spec, check_branch)
let err = ''
if isdirectory(a:spec.dir)
let result = s:lines(s:system('git rev-parse --abbrev-ref HEAD 2>&1 && git config -f .git/config remote.origin.url', a:spec.dir))
let result = [s:git_local_branch(a:spec.dir), s:git_origin_url(a:spec.dir)]
let remote = result[-1]
if v:shell_error
if empty(remote)
let err = join([remote, 'PlugClean required.'], "\n")
elseif !s:compare_git_uri(remote, a:spec.uri)
let err = join(['Invalid URI: '.remote,
\ 'Expected: '.a:spec.uri,
\ 'PlugClean required.'], "\n")
elseif a:check_branch && has_key(a:spec, 'commit')
let result = s:lines(s:system('git rev-parse HEAD 2>&1', a:spec.dir))
let sha = result[-1]
if v:shell_error
let sha = s:git_revision(a:spec.dir)
if empty(sha)
let err = join(add(result, 'PlugClean required.'), "\n")
elseif !s:hash_match(sha, a:spec.commit)
let err = join([printf('Invalid HEAD (expected: %s, actual: %s)',
@@ -2230,8 +2331,9 @@ function! s:git_validate(spec, check_branch)
\ 'PlugUpdate required.'], "\n")
endif
elseif a:check_branch
let branch = result[0]
let current_branch = result[0]
" Check tag
let origin_branch = s:git_origin_branch(a:spec)
if has_key(a:spec, 'tag')
let tag = s:system_chomp('git describe --exact-match --tags HEAD 2>&1', a:spec.dir)
if a:spec.tag !=# tag && a:spec.tag !~ '\*'
@@ -2239,14 +2341,14 @@ function! s:git_validate(spec, check_branch)
\ (empty(tag) ? 'N/A' : tag), a:spec.tag)
endif
" Check branch
elseif a:spec.branch !=# branch
elseif origin_branch !=# current_branch
let err = printf('Invalid branch: %s (expected: %s). Try PlugUpdate.',
\ branch, a:spec.branch)
\ current_branch, origin_branch)
endif
if empty(err)
let [ahead, behind] = split(s:lastline(s:system([
\ 'git', 'rev-list', '--count', '--left-right',
\ printf('HEAD...origin/%s', a:spec.branch)
\ printf('HEAD...origin/%s', origin_branch)
\ ], a:spec.dir)), '\t')
if !v:shell_error && ahead
if behind
@@ -2254,11 +2356,11 @@ function! s:git_validate(spec, check_branch)
" pushable (and probably not that messed up).
let err = printf(
\ "Diverged from origin/%s (%d commit(s) ahead and %d commit(s) behind!\n"
\ .'Backup local changes and run PlugClean and PlugUpdate to reinstall it.', a:spec.branch, ahead, behind)
\ .'Backup local changes and run PlugClean and PlugUpdate to reinstall it.', origin_branch, ahead, behind)
else
let err = printf("Ahead of origin/%s by %d commit(s).\n"
\ .'Cannot update until local changes are pushed.',
\ a:spec.branch, ahead)
\ origin_branch, ahead)
endif
endif
endif
@@ -2519,26 +2621,34 @@ function! s:preview_commit()
let sha = matchstr(getline('.'), '^ \X*\zs[0-9a-f]\{7,9}')
if empty(sha)
let name = matchstr(getline('.'), '^- \zs[^:]*\ze:$')
if empty(name)
return
endif
let title = 'HEAD@{1}..'
let command = 'git diff --no-color HEAD@{1}'
else
let title = sha
let command = 'git show --no-color --pretty=medium '.sha
let name = s:find_name(line('.'))
endif
if empty(name) || !has_key(g:plugs, name) || !isdirectory(g:plugs[name].dir)
return
endif
if exists('g:plug_pwindow') && !s:is_preview_window_open()
execute g:plug_pwindow
execute 'e' sha
execute 'e' title
else
execute 'pedit' sha
execute 'pedit' title
wincmd P
endif
setlocal previewwindow filetype=git buftype=nofile nobuflisted modifiable
setlocal previewwindow filetype=git buftype=nofile bufhidden=wipe nobuflisted modifiable
let batchfile = ''
try
let [sh, shellcmdflag, shrd] = s:chsh(1)
let cmd = 'cd '.plug#shellescape(g:plugs[name].dir).' && git show --no-color --pretty=medium '.sha
let cmd = 'cd '.plug#shellescape(g:plugs[name].dir).' && '.command
if s:is_win
let [batchfile, cmd] = s:batchfile(cmd)
endif
@@ -2588,7 +2698,9 @@ function! s:diff()
endif
call s:append_ul(2, origin ? 'Pending updates:' : 'Last update:')
for [k, v] in plugs
let range = origin ? '..origin/'.v.branch : 'HEAD@{1}..'
let branch = s:git_origin_branch(v)
if len(branch)
let range = origin ? '..origin/'.branch : 'HEAD@{1}..'
let cmd = ['git', 'log', '--graph', '--color=never']
if s:git_version_requirement(2, 10, 0)
call add(cmd, '--no-show-signature')
@@ -2603,6 +2715,7 @@ function! s:diff()
call append(5, extend(['', '- '.k.':'.ref], map(s:lines(diff), 's:format_git_log(v:val)')))
let cnts[origin] += 1
endif
endif
let bar .= '='
call s:progress_bar(2, bar, len(total))
normal! 2G
@@ -2661,9 +2774,9 @@ function! s:snapshot(force, ...) abort
1
let anchor = line('$') - 3
let names = sort(keys(filter(copy(g:plugs),
\'has_key(v:val, "uri") && !has_key(v:val, "commit") && isdirectory(v:val.dir)')))
\'has_key(v:val, "uri") && isdirectory(v:val.dir)')))
for name in reverse(names)
let sha = s:system_chomp(['git', 'rev-parse', '--short', 'HEAD'], g:plugs[name].dir)
let sha = has_key(g:plugs[name], 'commit') ? g:plugs[name].commit : s:git_revision(g:plugs[name].dir)
if !empty(sha)
call append(anchor, printf("silent! let g:plugs['%s'].commit = '%s'", name, sha))
redraw

View File

@@ -0,0 +1,162 @@
" A simple dark vim colorscheme.
" Created by Michael Campagnaro (https://git.michael.is)
if has('termguicolors')
" Supports 24-bit color range
set termguicolors
let g:campo_theme_use_rainbow_parens = 0
else
echoerr "This theme requires 'termguicolors' support!"
endif
if !has("gui_running") && &t_Co != 88 && &t_Co != 256
echoerr "Don't have expected color support!"
endif
set background=dark
hi clear
syntax reset
source $HOME/.vim/colors/utils
let g:colors_name = "campo-dark-blue"
" Shared colors
let s:blue = "3699cc"
let s:purple = "ce93d8"
let s:grey = "b0bec5"
let s:orange = "ffb74d"
let s:yellow = "fff176"
let s:green = "88b888"
let s:red = "ef2929"
let s:text = "f1f1e8" " A majority of the syntax will use this.
let s:bg = "072730"
let s:select = "546e8f"
let s:window = "37474f"
let s:comment = "5dea82"
let s:tab = "03404a"
let s:error = "e40e0e"
let s:proc = "0eefcb"
let s:warn = "dcd53e"
let s:spell = "aaf53e"
" Vim
call X("Normal", s:text, s:bg, "")
call X("LineNr", s:grey, "", "")
call X("NonText", s:text, "", "")
call X("SpecialKey", s:blue, "", "")
call X("Search", s:text, s:select, "")
call X("TabLineSel", s:text, s:bg, "bold")
call X("TabLine", "dddddd", s:tab, "none")
call X("TabLineFill", "", s:tab, "none") " The tab line region that doesn't contain tab entries.
call X("StatusLine", s:window, s:text, "reverse")
call X("StatusLineNC", s:window, s:comment, "reverse")
call X("VertSplit", s:window, s:window, "none")
call X("Visual", "", s:select, "")
call X("Directory", s:blue, "", "")
call X("ModeMsg", s:green, "", "")
call X("MoreMsg", s:green, "", "")
call X("Question", s:green, "", "")
call X("MatchParen", "", s:select, "")
call X("Folded", s:comment, s:bg, "")
call X("FoldColumn", s:comment, s:bg, "")
call X("SpellBad", s:spell, s:bg, "bold")
call X("SpellCap", s:text, s:bg, "") " A word that should start with a capital
call X("SpellLocal", s:spell, s:bg, "bold") " Correctly spelled but used in another region.
call X("SpellRare", s:text, s:bg, "") " A correctly spelled that is hardly ever used. Don't care about this.
call X("ErrorMsg", s:error, s:bg, "bold")
if version >= 700
call X("PMenu", s:text, s:select, "none") " Autocompletion menu
call X("PMenuSel", s:text, "027990", "bold") " Selected autocompletion item
call X("SignColumn", "", s:bg, "none")
call X("CursorLine", "", "022f36", "none") " Horizontal line at the cursor.
call X("CursorColumn", "", "022c33", "none") " Vertical line at the cursor.
end
if version >= 703
call X("ColorColumn", "", "022c33", "none") " Vertical line set by colorcolumn option.
end
" Standard Highlighting
call X("Comment", s:comment, "", "")
call X("Title", s:comment, "", "")
call X("Cursor", "", s:text, "")
call X("Identifier", s:grey, "", "none")
call X("Statement", s:text, "", "") " 'return', 'goto', 'case', 'break', etc
call X("Conditional", s:text, "", "")
call X("Repeat", s:text, "", "") " 'for' and 'while'
call X("Structure", "ae90ea", "", "")
call X("Function", s:proc, "", "")
call X("Constant", s:text, "", "") " Constants, e.g. SOME_CONST
call X("Boolean", s:text, "", "") " true, false
call X("String", s:text, "", "")
call X("Special", s:text, "", "")
call X("PreProc", s:text, "", "")
call X("Operator", s:text, "", "none")
call X("Type", s:text, "", "") " Data types
call X("Define", "a5bce4", "", "none")
call X("Include", s:text, "", "") " #include in C/C++
call X("Number", s:text, "", "")
" Notes
call X("Todo", "b8fbb0", s:bg, "underline")
call X("Bugs", "d8fbb0", s:bg, "standout")
call X("Notes", "ffffff", s:bg, "standout")
call X("Notices", s:warn, s:bg, "bold")
" Build markers
call X("BuildError", s:error, s:bg, "bold")
call X("BuildWarn", s:warn, s:bg, "bold")
call X("BuildInfo", s:text, s:bg, "bold")
" Jai Highlighting
call X("jaiVariableDeclaration", s:text, "", "")
call X("jaiTagNote", s:orange, "", "bold")
" airblade/vim-gitgutter
call X("GitGutterAdd", s:green, "", "")
call X("GitGutterDelete", s:red, "", "")
call X("GitGutterChange", s:yellow, "", "")
call X("GitGutterChangeDelete", s:orange, "", "")
" C Highlighting
call X("cType", s:text, "", "")
call X("cStorageClass", s:text, "", "")
call X("cConditional", s:text, "", "")
call X("cRepeat", s:text, "", "")
" Python Highlighting
call X("pythonInclude", s:red, "", "")
call X("pythonStatement", s:blue, "", "")
call X("pythonConditional", s:purple, "", "")
call X("pythonRepeat", s:purple, "", "")
call X("pythonException", s:purple, "", "")
call X("pythonFunction", s:proc, "", "")
call X("pythonSelf", s:grey, "", "")
call X("pythonOperator", s:purple, "", "")
call X("pythonExtraOperator", s:purple, "", "")
call X("pythonClass", s:proc, "", "")
call X("pythonDecorator", s:orange, "", "")
call X("pythonDocstring", s:comment, "", "")
call X("pythonBuiltinObj", s:yellow, "", "")
call X("pythonBuiltinType", s:orange, "", "")
call X("pythonNumber", s:orange, "", "")
" JS Highlighting
call X("javaScriptBraces", s:text, "", "")
call X("javaScriptFunction", s:purple, "", "")
call X("javaScriptConditional", s:purple, "", "")
call X("javaScriptRepeat", s:purple, "", "")
call X("javaScriptNumber", s:orange, "", "")
call X("javaScriptMember", s:orange, "", "")
" HTML Highlighting
call X("htmlTag", s:text, "", "")
call X("htmlTagName", s:text, "", "")
call X("htmlArg", s:text, "", "")
call X("htmlScriptTag", s:blue, "", "")
" Diff Highlighting
call X("DiffAdd", s:window, s:green, "none")
call X("DiffDelete", s:window, s:red, "none")
call X("DiffChange", s:window, s:yellow, "none")
call X("DiffText", s:bg, s:yellow, "none")

View File

@@ -447,9 +447,6 @@ if has("gui_running") || &t_Co == 88 || &t_Co == 256
call <SID>X("bladeKeyword", s:blue, "", "")
" Diff Highlighting
call <SID>X("diffAdded", "", s:green, "none")
call <SID>X("diffRemoved", "", s:red, "none")
call <SID>X("diffChanged", "", s:yellow, "none")
call <SID>X("DiffAdd", s:window, s:green, "none")
call <SID>X("DiffDelete", s:window, s:red, "none")
call <SID>X("DiffChange", s:window, s:yellow, "none")

View File

@@ -414,9 +414,6 @@ if has("gui_running") || &t_Co == 88 || &t_Co == 256
call <SID>X("bladeKeyword", s:blue, "", "")
" Diff Highlighting
call <SID>X("diffAdded", "", s:green, "none")
call <SID>X("diffRemoved", "", s:red, "none")
call <SID>X("diffChanged", "", s:yellow, "none")
call <SID>X("DiffAdd", s:window, s:green, "none")
call <SID>X("DiffDelete", s:window, s:red, "none")
call <SID>X("DiffChange", s:window, s:yellow, "none")

View File

@@ -432,9 +432,6 @@ if has("gui_running") || &t_Co == 88 || &t_Co == 256
call <SID>X("bladeKeyword", s:blue, "", "")
" Diff Highlighting
call <SID>X("diffAdded", "", s:green, "none")
call <SID>X("diffRemoved", "", s:red, "none")
call <SID>X("diffChanged", "", s:yellow, "none")
call <SID>X("DiffAdd", s:window, s:green, "none")
call <SID>X("DiffDelete", s:window, s:red, "none")
call <SID>X("DiffChange", s:window, s:yellow, "none")

View File

@@ -45,9 +45,9 @@ if has("gui_running") || &t_Co == 256
hi PmenuSel cterm=bold,reverse ctermfg=250 ctermbg=black gui=reverse guifg=#bcbcbc guibg=#0a0a0a
hi SpecialKey cterm=NONE ctermfg=16 ctermbg=255 gui=NONE guifg=#eeeeee guibg=#0a0a0a
hi MatchParen cterm=bold ctermfg=white ctermbg=black gui=NONE guifg=#bcbcbc guibg=#454545
hi CursorLine cterm=NONE ctermfg=NONE ctermbg=233 gui=NONE guifg=NONE guibg=#222222
hi CursorColumn cterm=NONE ctermfg=NONE ctermbg=233 gui=NONE guifg=NONE guibg=#222222
hi ColorColumn cterm=NONE ctermfg=NONE ctermbg=255 gui=NONE guifg=NONE guibg=#222222 " The column line set by colorcolumn
hi CursorLine cterm=NONE ctermfg=NONE ctermbg=233 gui=NONE guifg=NONE guibg=#111111
hi CursorColumn cterm=NONE ctermfg=NONE ctermbg=233 gui=NONE guifg=NONE guibg=#111111
hi ColorColumn cterm=NONE ctermfg=NONE ctermbg=255 gui=NONE guifg=NONE guibg=#171717 " The column line set by colorcolumn
hi StatusLine cterm=bold,reverse ctermfg=245 ctermbg=black gui=bold,reverse guifg=#8a8a8a guibg=#0a0a0a
hi StatusLineNC cterm=reverse ctermfg=236 ctermbg=black gui=reverse guifg=#303030 guibg=#0a0a0a
hi Visual cterm=reverse ctermfg=250 ctermbg=black gui=reverse guifg=#bcbcbc guibg=#0a0a0a
@@ -81,8 +81,6 @@ highlight! link Todo Keyword
highlight! link Label Keyword
highlight! link Define Keyword
highlight! link DiffAdd Keyword
highlight! link diffAdded Keyword
highlight! link diffCommon Keyword
highlight! link Directory Keyword
highlight! link PreCondit Keyword
highlight! link PreProc Keyword
@@ -101,11 +99,9 @@ highlight! link iCursor SpecialKey
highlight! link SpellLocal SpellCap
highlight! link NonText NonText
highlight! link DiffDelete Comment
highlight! link diffRemoved Comment
highlight! link PmenuSbar Visual
highlight! link VisualNOS Visual
highlight! link VertSplit VertSplit
highlight! link Cursor StatusLine
highlight! link Underlined SpellRare
highlight! link rstEmphasis SpellRare
highlight! link diffChanged DiffChange

View File

@@ -79,8 +79,6 @@ highlight! link Todo Keyword
highlight! link Label Keyword
highlight! link Define Keyword
highlight! link DiffAdd Keyword
highlight! link diffAdded Keyword
highlight! link diffCommon Keyword
highlight! link Directory Keyword
highlight! link PreCondit Keyword
highlight! link PreProc Keyword
@@ -100,10 +98,8 @@ highlight! link SpellLocal SpellCap
highlight! link LineNr Comment
highlight! link NonText NonText
highlight! link DiffDelete Comment
highlight! link diffRemoved Comment
highlight! link VisualNOS Visual
highlight! link VertSplit VertSplit
highlight! link Cursor StatusLine
highlight! link Underlined SpellRare
highlight! link rstEmphasis SpellRare
highlight! link diffChanged DiffChange

View File

@@ -1,5 +1,5 @@
" A simple light colorscheme.
" Maintainer: Michael Campagnaro <mikecampo@gmail.com>
" Maintainer: Michael Campagnaro
" Version: 1.0
"
" Adapted from https://github.com/tek256/simple-dark
@@ -81,8 +81,6 @@ highlight! link Todo Keyword
highlight! link Label Keyword
highlight! link Define Keyword
highlight! link DiffAdd Keyword
highlight! link diffAdded Keyword
highlight! link diffCommon Keyword
highlight! link Directory Keyword
highlight! link PreCondit Keyword
highlight! link PreProc Keyword
@@ -102,10 +100,8 @@ highlight! link SpellLocal SpellCap
highlight! link LineNr Comment
highlight! link NonText NonText
highlight! link DiffDelete Comment
highlight! link diffRemoved Comment
highlight! link VisualNOS Visual
highlight! link VertSplit VertSplit
highlight! link Cursor StatusLine
highlight! link Underlined SpellRare
highlight! link rstEmphasis SpellRare
highlight! link diffChanged DiffChange

View File

@@ -377,9 +377,6 @@ if has("gui_running") || &t_Co == 88 || &t_Co == 256
call <SID>X("htmlScriptTag", s:blue, "", "")
" Diff Highlighting
call <SID>X("diffAdded", "", s:green, "none")
call <SID>X("diffRemoved", "", s:red, "none")
call <SID>X("diffChanged", "", s:yellow, "none")
call <SID>X("DiffAdd", s:window, s:green, "none")
call <SID>X("DiffDelete", s:window, s:red, "none")
call <SID>X("DiffChange", s:window, s:yellow, "none")

209
.vim/colors/utils Normal file
View File

@@ -0,0 +1,209 @@
" Hex color conversion functions are from https://github.com/vim-scripts/desert256.vim/blob/master/colors/desert256.vim
" Returns an approximate grey index for the given grey level
function! GreyNumber(x)
if &t_Co == 88
if a:x < 23
return 0
elseif a:x < 69
return 1
elseif a:x < 103
return 2
elseif a:x < 127
return 3
elseif a:x < 150
return 4
elseif a:x < 173
return 5
elseif a:x < 196
return 6
elseif a:x < 219
return 7
elseif a:x < 243
return 8
else
return 9
endif
else
if a:x < 14
return 0
else
let l:n = (a:x - 8) / 10
let l:m = (a:x - 8) % 10
if l:m < 5
return l:n
else
return l:n + 1
endif
endif
endif
endfun
" Returns the actual grey level represented by the grey index
function! GreyLevel(n)
if &t_Co == 88
if a:n == 0
return 0
elseif a:n == 1
return 46
elseif a:n == 2
return 92
elseif a:n == 3
return 115
elseif a:n == 4
return 139
elseif a:n == 5
return 162
elseif a:n == 6
return 185
elseif a:n == 7
return 208
elseif a:n == 8
return 231
else
return 255
endif
else
if a:n == 0
return 0
else
return 8 + (a:n * 10)
endif
endif
endfun
" Returns the palette index for the given grey index
function! GreyColor(n)
if &t_Co == 88
if a:n == 0
return 16
elseif a:n == 9
return 79
else
return 79 + a:n
endif
else
if a:n == 0
return 16
elseif a:n == 25
return 231
else
return 231 + a:n
endif
endif
endfun
" Returns an approximate colour index for the given colour level
function! RGBNumber(x)
if &t_Co == 88
if a:x < 69
return 0
elseif a:x < 172
return 1
elseif a:x < 230
return 2
else
return 3
endif
else
if a:x < 75
return 0
else
let l:n = (a:x - 55) / 40
let l:m = (a:x - 55) % 40
if l:m < 20
return l:n
else
return l:n + 1
endif
endif
endif
endfun
" Returns the actual colour level for the given colour index
function! RGBLevel(n)
if &t_Co == 88
if a:n == 0
return 0
elseif a:n == 1
return 139
elseif a:n == 2
return 205
else
return 255
endif
else
if a:n == 0
return 0
else
return 55 + (a:n * 40)
endif
endif
endfun
" Returns the palette index for the given R/G/B colour indices
function! RGBColor(x, y, z)
if &t_Co == 88
return 16 + (a:x * 16) + (a:y * 4) + a:z
else
return 16 + (a:x * 36) + (a:y * 6) + a:z
endif
endfun
" Returns the palette index to approximate the given R/G/B colour levels
function! Color(r, g, b)
" Get the closest grey
let l:gx = GreyNumber(a:r)
let l:gy = GreyNumber(a:g)
let l:gz = GreyNumber(a:b)
" Get the closest colour
let l:x = RGBNumber(a:r)
let l:y = RGBNumber(a:g)
let l:z = RGBNumber(a:b)
if l:gx == l:gy && l:gy == l:gz
" There are two possibilities
let l:dgr = GreyLevel(l:gx) - a:r
let l:dgg = GreyLevel(l:gy) - a:g
let l:dgb = GreyLevel(l:gz) - a:b
let l:dgrey = (l:dgr * l:dgr) + (l:dgg * l:dgg) + (l:dgb * l:dgb)
let l:dr = RGBLevel(l:gx) - a:r
let l:dg = RGBLevel(l:gy) - a:g
let l:db = RGBLevel(l:gz) - a:b
let l:drgb = (l:dr * l:dr) + (l:dg * l:dg) + (l:db * l:db)
if l:dgrey < l:drgb
" Use the grey
return GreyColor(l:gx)
else
" Use the colour
return RGBColor(l:x, l:y, l:z)
endif
else
" Only one possibility
return RGBColor(l:x, l:y, l:z)
endif
endfun
" Returns the palette index to approximate the 'rrggbb' hex string
function! RGB(rgb)
let l:r = ("0x" . strpart(a:rgb, 0, 2)) + 0
let l:g = ("0x" . strpart(a:rgb, 2, 2)) + 0
let l:b = ("0x" . strpart(a:rgb, 4, 2)) + 0
return Color(l:r, l:g, l:b)
endfun
" Sets the highlighting for the given group
function! X(group, fg, bg, attr)
if a:fg != ""
exec "hi " . a:group . " guifg=#" . a:fg . " ctermfg=" . RGB(a:fg)
endif
if a:bg != ""
exec "hi " . a:group . " guibg=#" . a:bg . " ctermbg=" . RGB(a:bg)
endif
if a:attr != ""
exec "hi " . a:group . " gui=" . a:attr . " cterm=" . a:attr
endif
endfun

View File

View File

@@ -266,3 +266,12 @@ throughs
throughs
incentivise
malware
foofy
memcpy
strlen
u8
s64
Sculpey
grey
googly
favour

BIN
.vim/spell/en.utf-8.add.spl Normal file

Binary file not shown.

1653
.vimrc Normal file

File diff suppressed because it is too large Load Diff

View File

View File

View File

@@ -1,11 +0,0 @@
# dotfiles
Various dotfiles and misc configs. Some of it is customized around my system setup
(like aliases pointing to paths) but you should be able to easily remove that stuff.
## Installing
There is an `install` script that facilitates the setup, however it's been a while since I did a
full system setup and this script may not be fully complete. An alternative method is to manually
symlink files in the root directory. OS specific configs are in their respective folders.

View File

@@ -1,44 +0,0 @@
#!/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
use_gpu=$1
filename=$(basename -- "$2")
output_name="$3"
start_time="$4"
end_time="$5"
if [[ $use_gpu == "" || $2 == "" || $output_name == "" || $start_time == "" || $end_time == "" ]]; then
printf "${BOLD}${RED}Usage: $0 <use-gpu (1|0)> <filename> <output name> <start time HH:MM:SS> <end time HH:MM:SS>${NORMAL}\n"
exit 1
fi
# Found the following to work best with vids containing text (e.g. programming vid): 25 for CPU encoding and 27 for GPU.
use_crf=25
if [[ $use_gpu -eq 1 ]]; then
use_crf=27
fi
compress-video-with-crf $use_gpu $use_crf "$filename" "$output_name" "$start_time" "$end_time"

View File

@@ -1,16 +0,0 @@
#!/usr/bin/env bash
# Copies vim data from the home directory to the dotfiles repo.
set -e
src="$HOME/.vim"
dest="$HOME/.dotfiles/vim/"
if [ -d $src ]; then
[ -d "$src/spell" ] && echo "Syncing user dictionary" && cp -r "$src/spell" $dest
[ -d "$src/colors" ] && echo "Syncing user colors" && cp -r "$src/colors" $dest
[ -d "$src/after" ] && echo "Syncing after directory" && cp -r "$src/after" $dest
[ -d "$src/ftdetect" ] && echo "Syncing ftdetect" && cp -r "$src/ftdetect" $dest
[ -d "$src/autoload" ] && echo "Syncing autoload" && cp -r "$src/autoload" $dest
fi

View File

@@ -1,16 +0,0 @@
#!/usr/bin/env bash
# Copies vim data from the dotfiles repo to the home directory.
set -e
src="$HOME/.dotfiles/vim"
dest="$HOME/.vim/"
if [ -d $src ]; then
[ -d "$src/spell" ] && echo "Syncing user dictionary" && cp -r "$src/spell" $dest
[ -d "$src/colors" ] && echo "Syncing user colors" && cp -r "$src/colors" $dest
[ -d "$src/after" ] && echo "Syncing after directory" && cp -r "$src/after" $dest
[ -d "$src/ftdetect" ] && echo "Syncing ftdetect" && cp -r "$src/ftdetect" $dest
[ -d "$src/autoload" ] && echo "Syncing autoload" && cp -r "$src/autoload" $dest
fi

21
dotfiles/.editorconfig Normal file
View File

@@ -0,0 +1,21 @@
# EditorConfig helps developers define and maintain consistent
# coding styles # between different editors and IDEs
# editorconfig.org
root = true
[*]
indent_style = space
indent_size = 4
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
[*.bat]
end_of_line = crlf
[*.tsv]
indent_style = tab

32
dotfiles/README.md Normal file
View File

@@ -0,0 +1,32 @@
# dotfiles
Various dotfiles and misc configs. Some of it is customized around my system
setup (like aliases pointing to paths) but you should be able to easily remove
that stuff.
This unpacks files one directory back, which is assumed to be your home
directory. The gitignore ignores all files by default. If you want to add a new
file this you need to add the `-f` flag to the git add command. This setup was
inspired by Gary Bernhardt and https://gist.github.com/meleu/053275b6842646b95491bf1af4a6ca0e
## Installing
```bash
# Go to your home directory.
cd ~
# Clone the repo with the "--no-checkout" option (so we can checkout the files in our home directory)
git clone --no-checkout <repo_url>/dotfiles.git
# Go to the created directory and change the worktree to the home direcory.
cd dotfiles
git config core.worktree '../../'
# Checkout the files. This will overwrite existing dotfiles with the same name.
git reset --hard origin/master
```
If you want to install optional OS specific stuff, like various packages, run the `install` script in this folder.
OS specific configs are in their respective folders.

View File

@@ -0,0 +1,107 @@
@setlocal enableextensions enabledelayedexpansion
@echo off
rem Make sure we're running as admin. Got this garbage from https://stackoverflow.com/a/40388766
if not "%1"=="am_admin" (
powershell -Command "Start-Process -Verb RunAs -FilePath '%0' -ArgumentList 'am_admin'"
exit /b
)
rem USE AT OWN RISK AS IS WITHOUT WARRANTY OF ANY KIND !!!!!
rem NOTE: Defender may see this file as malware, so you will likely need to exclude this before things can be disabled.
rem
rem Modified version of
rem https://raw.githubusercontent.com/mattreecebentley/win10_disable_defender/main/win10_enable_defender.bat
rem https://gist.github.com/xezrunner/a7a42dbc1096a40b0c78f09488fe5a2b
reg query HKLM\SYSTEM\Setup /v DisabledDefenderServices | find "0x1"
if %errorlevel% == 0 goto already_patched
echo.
echo Please note that Defender can only be disabled in Win10 v2004 and upwards if Tamper Protection is disabled.
echo This setting can be found in Window settings (hint: search for 'tamper'). Please do this now and then,
pause
echo.
echo Disabling Windows Defender
rem from: https://pastebin.com/kYCVzZPz
rem Disable Tamper Protection First - on WIn10 vers which allow for this (not from 2004 onwards)
reg add "HKLM\Software\Microsoft\Windows Defender\Features" /v "TamperProtection" /t REG_DWORD /d "0" /f
rem To disable System Guard Runtime Monitor Broker
rem reg add "HKLM\System\CurrentControlSet\Services\SgrmBroker" /v "Start" /t REG_DWORD /d "4" /f
rem To disable Windows Defender Security Center include this
rem reg add "HKLM\System\CurrentControlSet\Services\SecurityHealthService" /v "Start" /t REG_DWORD /d "4" /f
echo.
echo Disable Real-time protection
reg delete "HKLM\Software\Policies\Microsoft\Windows Defender" /f
reg add "HKLM\Software\Policies\Microsoft\Windows Defender" /v "DisableAntiSpyware" /t REG_DWORD /d "1" /f
reg add "HKLM\Software\Policies\Microsoft\Windows Defender" /v "DisableAntiVirus" /t REG_DWORD /d "1" /f
reg add "HKLM\Software\Policies\Microsoft\Windows Defender\MpEngine" /v "MpEnablePus" /t REG_DWORD /d "0" /f
reg add "HKLM\Software\Policies\Microsoft\Windows Defender\Real-Time Protection" /v "DisableBehaviorMonitoring" /t REG_DWORD /d "1" /f
reg add "HKLM\Software\Policies\Microsoft\Windows Defender\Real-Time Protection" /v "DisableIOAVProtection" /t REG_DWORD /d "1" /f
reg add "HKLM\Software\Policies\Microsoft\Windows Defender\Real-Time Protection" /v "DisableOnAccessProtection" /t REG_DWORD /d "1" /f
reg add "HKLM\Software\Policies\Microsoft\Windows Defender\Real-Time Protection" /v "DisableRealtimeMonitoring" /t REG_DWORD /d "1" /f
reg add "HKLM\Software\Policies\Microsoft\Windows Defender\Real-Time Protection" /v "DisableRoutinelyTakingAction" /t REG_DWORD /d "1" /f
reg add "HKLM\Software\Policies\Microsoft\Windows Defender\Real-Time Protection" /v "DisableScanOnRealtimeEnable" /t REG_DWORD /d "1" /f
reg add "HKLM\Software\Policies\Microsoft\Windows Defender\Reporting" /v "DisableEnhancedNotifications" /t REG_DWORD /d "1" /f
reg add "HKLM\Software\Policies\Microsoft\Windows Defender\SpyNet" /v "DisableBlockAtFirstSeen" /t REG_DWORD /d "1" /f
reg add "HKLM\Software\Policies\Microsoft\Windows Defender\SpyNet" /v "SpynetReporting" /t REG_DWORD /d "0" /f
reg add "HKLM\Software\Policies\Microsoft\Windows Defender\SpyNet" /v "SubmitSamplesConsent" /t REG_DWORD /d "2" /f
echo.
echo Disable Logging
reg add "HKLM\System\CurrentControlSet\Control\WMI\Autologger\DefenderApiLogger" /v "Start" /t REG_DWORD /d "0" /f
reg add "HKLM\System\CurrentControlSet\Control\WMI\Autologger\DefenderAuditLogger" /v "Start" /t REG_DWORD /d "0" /f
echo.
echo Disable WD Tasks
schtasks /Change /TN "Microsoft\Windows\ExploitGuard\ExploitGuard MDM policy Refresh" /Disable
schtasks /Change /TN "Microsoft\Windows\Windows Defender\Windows Defender Cache Maintenance" /Disable
schtasks /Change /TN "Microsoft\Windows\Windows Defender\Windows Defender Cleanup" /Disable
schtasks /Change /TN "Microsoft\Windows\Windows Defender\Windows Defender Scheduled Scan" /Disable
schtasks /Change /TN "Microsoft\Windows\Windows Defender\Windows Defender Verification" /Disable
echo.
echo Disable WD systray icon
reg delete "HKLM\Software\Microsoft\Windows\CurrentVersion\Explorer\StartupApproved\Run" /v "SecurityHealth" /f
reg delete "HKLM\Software\Microsoft\Windows\CurrentVersion\Run" /v "SecurityHealth" /f
echo.
echo Remove WD context menu
reg delete "HKCR\*\shellex\ContextMenuHandlers\EPP" /f
reg delete "HKCR\Directory\shellex\ContextMenuHandlers\EPP" /f
reg delete "HKCR\Drive\shellex\ContextMenuHandlers\EPP" /f
echo.
echo Disable WD services
reg add HKLM\SYSTEM\CurrentControlSet\Services\wscsvc /v "Start" /t REG_DWORD /d "4" /f
reg add "HKLM\System\CurrentControlSet\Services\WdBoot" /v "Start" /t REG_DWORD /d "4" /f
reg add "HKLM\System\CurrentControlSet\Services\wdFilter" /v "Start" /t REG_DWORD /d "4" /f
reg add "HKLM\System\CurrentControlSet\Services\WdNisDrv" /v "Start" /t REG_DWORD /d "4" /f
reg add "HKLM\System\CurrentControlSet\Services\WdNisSvc" /v "Start" /t REG_DWORD /d "4" /f
reg add "HKLM\System\CurrentControlSet\Services\WinDefend" /v "Start" /t REG_DWORD /d "4" /f
echo.
echo Disable Security system tray icon
reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows Defender Security Center\Systray" /v "HideSystray" /t REG_DWORD /d "1" /f
echo.
echo Finishing up...
reg add HKLM\SYSTEM\Setup /v DisabledDefenderServices /t REG_DWORD /d 1 /f
echo.
echo Windows Defender has (hopefully) been disabled.
echo You should still be able to scan files going forward. Also, the Antimalware Service Executable should immediately stop using CPU cycles.
echo Please restart your computer to see all changes.
goto eof
:already_patched
echo Defender has already been disabled by this script.
:eof
echo.
pause

View File

@@ -0,0 +1,108 @@
@setlocal enableextensions enabledelayedexpansion
@echo off
rem Make sure we're running as admin. Got this garbage from https://stackoverflow.com/a/40388766
if not "%1"=="am_admin" (
powershell -Command "Start-Process -Verb RunAs -FilePath '%0' -ArgumentList 'am_admin'"
exit /b
)
rem USE AT OWN RISK AS IS WITHOUT WARRANTY OF ANY KIND !!!!!
rem
rem Modified version of
rem https://raw.githubusercontent.com/mattreecebentley/win10_disable_defender/main/win10_enable_defender.bat
rem https://gist.github.com/xezrunner/a7a42dbc1096a40b0c78f09488fe5a2b
rem
rem Resources:
rem https://docs.microsoft.com/en-us/powershell/module/defender/set-mppreference?view=win10-ps
rem https://docs.microsoft.com/en-us/windows/threat-protection/windows-defender-exploit-guard/customize-exploit-protection
rem https://github.com/AndyFul/ConfigureDefender
rem https://github.com/AndyFul/Hard_Configurator
echo.
echo Enabling Windows Defender
reg query HKLM\SYSTEM\Setup /v DisabledDefenderServices | find "0x0"
if %errorlevel% == 0 goto already_patched
reg delete "HKLM\Software\Policies\Microsoft\Windows Defender" /f
reg add "HKLM\Software\Microsoft\Windows\CurrentVersion\Run" /v "SecurityHealth" /t REG_EXPAND_SZ /d "\"%windir%\system32\SecurityHealthSystray.exe\"" /f
echo.
echo Restore WD shell
reg add "HKLM\Software\Classes\*\shellex\ContextMenuHandlers\EPP" /ve /t REG_SZ /d "{09A47860-11B0-4DA5-AFA5-26D86198A780}" /f
reg add "HKLM\Software\Classes\Drive\shellex\ContextMenuHandlers\EPP" /ve /t REG_SZ /d "{09A47860-11B0-4DA5-AFA5-26D86198A780}" /f
reg add "HKLM\Software\Classes\Directory\shellex\ContextMenuHandlers\EPP" /ve /t REG_SZ /d "{09A47860-11B0-4DA5-AFA5-26D86198A780}" /f
echo.
echo Enable WD services
reg add "HKLM\System\CurrentControlSet\Services\BFE" /v "Start" /t REG_DWORD /d "2" /f
reg add "HKLM\System\CurrentControlSet\Services\MpsSvc" /v "Start" /t REG_DWORD /d "2" /f
reg add "HKLM\System\CurrentControlSet\Services\SecurityHealthService" /v "Start" /t REG_DWORD /d "2" /f
reg add "HKLM\System\CurrentControlSet\Services\SgrmBroker" /v "Start" /t REG_DWORD /d "2" /f
reg add "HKLM\System\CurrentControlSet\Services\wscsvc" /v "Start" /t REG_DWORD /d "2" /f
reg add "HKLM\System\CurrentControlSet\Services\WdBoot" /v "Start" /t REG_DWORD /d "2" /f
reg add "HKLM\System\CurrentControlSet\Services\wdFilter" /v "Start" /t REG_DWORD /d "2" /f
reg add "HKLM\System\CurrentControlSet\Services\WdNisDrv" /v "Start" /t REG_DWORD /d "2" /f
reg add "HKLM\System\CurrentControlSet\Services\WdNisSvc" /v "Start" /t REG_DWORD /d "2" /f
reg add "HKLM\System\CurrentControlSet\Services\WinDefend" /v "Start" /t REG_DWORD /d "2" /f
echo.
echo 1 - Enable Logging
reg add "HKLM\System\CurrentControlSet\Control\WMI\Autologger\DefenderApiLogger" /v "Start" /t REG_DWORD /d "1" /f
reg add "HKLM\System\CurrentControlSet\Control\WMI\Autologger\DefenderAuditLogger" /v "Start" /t REG_DWORD /d "1" /f
echo.
echo Enable WD Tasks
schtasks /Change /TN "Microsoft\Windows\ExploitGuard\ExploitGuard MDM policy Refresh" /Enable
schtasks /Change /TN "Microsoft\Windows\Windows Defender\Windows Defender Cache Maintenance" /Enable
schtasks /Change /TN "Microsoft\Windows\Windows Defender\Windows Defender Cleanup" /Enable
schtasks /Change /TN "Microsoft\Windows\Windows Defender\Windows Defender Scheduled Scan" /Enable
schtasks /Change /TN "Microsoft\Windows\Windows Defender\Windows Defender Verification" /Enable
echo.
echo Setting various preferences
rem CloudExtendedTimeout / 1 - 50 / block a suspicious file for up to 60 seconds (Default is 10)
reg add "HKLM\Software\Policies\Microsoft\Windows Defender\MpEngine" /v "MpBafsExtendedTimeout" /t REG_DWORD /d "0" /f
rem CloudBlockLevel / 0 - Default / 2 - High / 4 - High+ / 6 - Zero tolerance (block all unknown executables)
reg add "HKLM\Software\Policies\Microsoft\Windows Defender\MpEngine" /v "MpCloudBlockLevel" /t REG_DWORD /d "0" /f
rem 1 - Potentially Unwanted Application protection (PUP) is enabled, the applications with unwanted behavior will be blocked at download and install-time
reg add "HKLM\Software\Policies\Microsoft\Windows Defender\MpEngine" /v "MpEnablePus" /t REG_DWORD /d "1" /f
rem Block at First Sight / 0 - Enable / 1 - Disable
reg add "HKLM\Software\Policies\Microsoft\Windows Defender\SpyNet" /v "DisableBlockAtFirstSeen" /t REG_DWORD /d "0" /f
rem Cloud-based Protection / 0 - Disable / 1 - Basic / 2 - Advanced
reg add "HKLM\Software\Policies\Microsoft\Windows Defender\SpyNet" /v "SpynetReporting" /t REG_DWORD /d "1" /f
rem Send file samples when further analysis is required / 0 - Always prompt / 1 - Send safe samples automatically / 2 - Never send / 3 - Send all samples automatically
reg add "HKLM\Software\Policies\Microsoft\Windows Defender\SpyNet" /v "SubmitSamplesConsent" /t REG_DWORD /d "0" /f
echo.
echo Attempting to enable Tamper Protection. If this fails then you need to do it manually.
reg add "HKLM\Software\Microsoft\Windows Defender\Features" /v "TamperProtection" /t REG_DWORD /d "1" /f
rem To prevent WD using too much CPU, add this file to the exclusion list:
rem C:\Program Files\Windows Defender\MsMpEng.exe
echo.
echo Attempting to exclude MsMpEng.exe to reduce CPU usage
reg add "HKLM\Software\Microsoft\Windows Defender\Exclusions\Paths" /v "C:\Program Files\Windows Defender\MsMpEng.exe" /t REG_DWORD /d "0" /f
echo.
echo Finishing up...
reg add HKLM\SYSTEM\Setup /v DisabledDefenderServices /t REG_DWORD /d 0 /f
echo Windows Defender has (hopefully) been enabled.
echo The Antimalware Service Executable should be active again.
echo Restart your computer to see all changes.
goto eof
:already_patched
echo Defender has already been enabled by this script.
:eof
echo.
pause

View File

@@ -42,6 +42,7 @@ if [[ ! -d "$repo_path" ]]; then
exit 1
fi
output_path="$output_path/svn"
mkdir -p "$output_path"
now=$(echo $(date '+%Y-%m-%d-%H-%M-%S'))

View File

@@ -23,20 +23,25 @@ else
NORMAL=""
fi
use_gpu=$1
filename=$(basename -- "$2")
output_name="$3"
use_gpu=0
if [[ $use_gpu == "" || $2 == "" || $output_name == "" ]]; then
printf "${BOLD}${RED}Usage: $0 <use-gpu (1|0)> <filename> <output name>${NORMAL}\n"
if [[ $# < 2 || $# > 3 ]]; then
printf "${BOLD}${RED}Usage: $0 <filename> <output name> <optional: use-gpu (1|0), defaults to $use_gpu> ${NORMAL}\n"
exit 1
fi
# Found the following to work best with vids containing text (e.g. programming vid): 25 for CPU encoding and 27 for GPU.
use_crf=25
if [[ $use_gpu -eq 1 ]]; then
use_crf=27
filename=$(basename -- "$1")
output_name="$2"
if [[ $# > 2 ]]; then
use_gpu=$3
fi
compress-video-with-crf $use_gpu $use_crf "$filename" "$output_name"
# Found the following to work best with vids containing text (e.g. programming vid): 25 for CPU encoding and 27 for GPU.
use_crf=21
if [[ $use_gpu -eq 1 ]]; then
use_crf=25
fi
compress-video-with-crf $use_crf "$filename" "$output_name" $use_gpu

View File

@@ -23,22 +23,36 @@ else
NORMAL=""
fi
use_gpu=$1
use_crf=$2
output_name="$4"
start_time="$5"
end_time="$6"
use_gpu=0
if [[ $use_gpu == "" || $use_crf == "" || $3 == "" || $output_name == "" || ($start_time != "" && $end_time == "") ]]; then
printf "${BOLD}${RED}Usage: $0 <use-gpu (1|0)> <crf value> <filename> <output name> <optional start time HH:MM:SS> <optional end time HH:MM:SS>\n\nIf you want to encode a range of CRF values then use -1 as the crf value.${NORMAL}\n"
if [[ "$#" < 3 || "$#" > 6 ]]; then
printf "${BOLD}${RED}Usage: $0 <crf value> <filename> <output name> <optional: use-gpu (1|0), defaults to $use_gpu> <optional: start time HH:MM:SS> <optional: end time HH:MM:SS>\n\nIf you want to encode a range of CRF values then use -1 as the crf value.${NORMAL}\n"
exit 1
fi
use_crf=$1
filename=$(basename -- "$3")
filename=$(basename -- "$2")
extension="${filename##*.}"
filename="${filename%.*}"
output_name="$3"
if [[ "$#" > 3 ]]; then
use_gpu=$4
if [[ "$#" > 4 ]]; then
start_time="$5"
if [[ "$#" > 5 ]]; then
end_time="$6"
fi
fi
fi
if [[ $use_gpu -ne 0 && $use_gpu -ne 1 ]]; then
printf "${BOLD}${RED}Invalid use_gpu value. Got $use_gpu, but expected either 0 or 1${NORMAL}\n"
exit 1
fi
function encode() {
crf=$1
output="${output_name}.$extension"
@@ -52,9 +66,14 @@ function encode() {
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.
# RTX 3080
ffmpeg -y -stats -loglevel level+error $timing_args -vsync 0 -hwaccel cuda -hwaccel_output_format cuda -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"
# GTX 1070
#ffmpeg -y -stats -loglevel level+error $timing_args -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 $timing_args -i "$filename.$extension" -c:v libx264 -crf $crf -preset veryfast -profile:v baseline -level 3.0 -strict -2 "$output"
ffmpeg -y -stats -loglevel level+error $timing_args -i "$filename.$extension" -c:v libx264 -crf $crf -preset veryfast -profile:v high -level 3.0 -strict -2 "$output"
fi
printf "\n${GREEN}${BOLD}Finished encoding '$filename.$extension' (CRF $crf) | output name '$output'${NORMAL}\n\n"
}

View File

@@ -29,7 +29,7 @@ else
fi
if [[ $1 == "" || $2 == "" ]]; then
printf "${BOLD}${RED}Format: $0 <filename> <bitrate, e.g. \"4000k\"> <optional output name>${NORMAL}\n"
printf "${BOLD}${RED}Usage: $0 <filename> <bitrate, e.g. \"4000k\"> <optional output name>${NORMAL}\n"
exit 1
fi

View File

@@ -27,7 +27,7 @@ else
fi
if [[ $1 == "" || $2 == "" ]]; then
printf "${BOLD}${RED}Format: $0 <compress 1|0> <filename> <optional output name>${NORMAL}\n"
printf "${BOLD}${RED}Usage: $0 <compress 1|0> <filename> <optional output name>${NORMAL}\n"
exit 1
fi

View File

@@ -0,0 +1,64 @@
#!/usr/bin/env bash
# This is for reencoding an mkv video to mp4 using an mpeg4 encoder.
# Can optionally compress the video.
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 == "" || $2 == "" ]]; then
printf "${BOLD}${RED}Usage: $0 <compress 1|0> <filename> <optional output name>${NORMAL}\n"
exit 1
fi
compress="$1"
filename=$(basename -- "$2")
extension="${filename##*.}"
filename="${filename%.*}"
output="$3"
if [[ $output == "" ]]; then
output="${filename}_CONVERTED"
fi
printf "\n${YELLOW}${BOLD}Encoding '$filename.$extension' | compress: $compress | output: $output.mp4${NORMAL}\n"
if [[ $compress -eq 1 ]]; then
temp_output="temp_$output.mp4"
else
temp_output="$output.mp4"
fi
# convert first.
# we convert then compress instead of compressing on first pass because this results in a slightly higher bitrate.
ffmpeg -y -stats -loglevel level+error -i "$filename.$extension" -vcodec copy -acodec copy "$temp_output"
if [[ $compress -eq 1 ]]; then
compress-video 1 "$temp_output" "$output"
rm "$temp_output"
else
printf "\n"
fi
printf "${GREEN}${BOLD}Done encoding '$filename.$extension' to '$output.mp4'${NORMAL}\n\n"

View File

@@ -0,0 +1,50 @@
#!/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
input="$1"
output_name="$2"
if [[ $input == "" || $output_name == "" ]]; then
printf "${BOLD}${RED}Usage: $0 <input video> <wav output name>${NORMAL}\n"
exit 1
fi
if [[ ! -f "$input" ]]; then
printf "${RED}${BOLD}Error: failed to extract audio. Video file \"$input\" doesn't exist.\n${NORMAL}"
exit 1
fi
# Add extension if not provided.
output_basename=$(basename -- "$output_name")
output_extension="${output_basename##*.}"
if [[ $output_extension != "wav" ]]; then
output_name="${output_name}.wav"
fi
printf "\n${YELLOW}${BOLD}Extracting 16-bit WAV from $input | output: $output_name${NORMAL}\n"
ffmpeg -i "$input" -ar 16000 -ac 1 -c:a pcm_s16le "$output_name"
printf "${GREEN}${BOLD}Done extracting 16-bit WAV from $input | output: $output_name${NORMAL}\n"

View File

@@ -41,7 +41,7 @@ if [[ $bitrate == "" ]]; then
bitrate="64"
fi
printf "\n${YELLOW}${BOLD}Extracting audio from '$filename.$extension' | bitrate: ${bitrate}k | output: $output_name${NORMAL}\n"
printf "\n${YELLOW}${BOLD}Extracting audio from $filename.$extension | bitrate: ${bitrate}k | output: $output_name${NORMAL}\n"
if [[ $transcode == "1" ]]; then
# Transcode audio
@@ -51,5 +51,5 @@ else
ffmpeg -i "$filename.$extension" -vn -acodec copy "$output_name"
fi
printf "\n${GREEN}${BOLD}Done extracting audio from '$filename.$extension' | output name '$output_name'${NORMAL}\n\n"
printf "\n${GREEN}${BOLD}Done extracting audio from $filename.$extension | output name '$output_name'${NORMAL}\n\n"

View File

@@ -0,0 +1,21 @@
@echo off
if exist %1\* (
echo directory
for /F "delims=" %%f in ('dir /b /s %1') do (
:: skip folders
if not exist "%%~f\" (
java -jar %DEV_TOOLS%\PortexAnalyzer.jar -p "%%~f_PortexAnalyzer_Report.png" -o "%%~f_PortexAnalyzer_Report.txt" "%%~f" | more
)
)
) else (
if exist "%~1_PortexAnalyzer_Report.txt" (
del "%~1_PortexAnalyzer_Report.txt"
)
if exist "%~1_PortexAnalyzer_Report.png" (
del "%~1_PortexAnalyzer_Report.png"
)
java -jar %DEV_TOOLS%\PortexAnalyzer.jar -p "%~1_PortexAnalyzer_Report.png" -o "%~1_PortexAnalyzer_Report.txt" "%~1" | more
start notepad "%~1_PortexAnalyzer_Report.txt"
start rundll32 "C:\Program Files (x86)\Windows Photo Viewer\PhotoViewer.dll", ImageView_Fullscreen %~1_PortexAnalyzer_Report.png
)

View File

@@ -0,0 +1,3 @@
@echo off
start %DEV_TOOLS%\ResourceHacker.exe "%~1"

View File

@@ -0,0 +1,12 @@
@echo off
cd %DEV_TOOLS%\SysinternalsSuite
if exist %1\* (
echo Run on a file
) else (
if exist "%~1_Report.txt" (
del "%~1_Report.txt"
)
sigcheck.exe /a "%~1" > "%~1_sigcheck_report.txt"
start notepad "%~1_sigcheck_report.txt"
)

View File

@@ -0,0 +1,3 @@
@echo off
start %DEV_TOOLS%\x64dbg\release\x32\x32dbg.exe "%~1"

View File

@@ -0,0 +1,3 @@
@echo off
start %DEV_TOOLS%\x64dbg\release\x64\x64dbg.exe "%~1"

View File

@@ -27,7 +27,7 @@ else
fi
if [[ $1 == "" ]]; then
printf "\n${BOLD}Usage: $0 <filename> <optional output name>${NORMAL}\n"
printf "${BOLD}${RED}Usage: $0 <filename> <optional output name>${NORMAL}\n"
exit 1
fi

View File

@@ -29,7 +29,7 @@ else
fi
if [[ $1 == "" ]]; then
printf "\n${BOLD}Usage: $0 <filename> <optional output name>${NORMAL}\n"
printf "${BOLD}${RED}Usage: $0 <filename> <optional output name>${NORMAL}\n"
exit 1
fi

View File

@@ -0,0 +1,49 @@
#!/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 <filename> <optional output name>${NORMAL}\n"
exit 1
fi
filename=$(basename -- "$1")
extension="${filename##*.}"
filename="${filename%.*}"
output_name="$2"
if [[ $output_name == "" ]]; then
output="${filename}_no_audio.$extension"
else
output="${output_name}.$extension"
fi
printf "\n${YELLOW}${BOLD}Removing audio from '$filename.$extension' | output: '$output'${NORMAL}\n"
# -an removes the audio.
ffmpeg -i "$filename.$extension" -c:v copy -an "$output"
printf "\n${GREEN}${BOLD}Done removing audio from '$filename.$extension' | output: '$output'${NORMAL}\n\n"

View File

@@ -1,6 +1,6 @@
#!/usr/bin/env bash
source "$HOME/.dotfiles/script_helpers/all.sh"
source "$HOME/dotfiles/script_helpers/all.sh"
cwd=$PWD
source_path=""

View File

@@ -0,0 +1,94 @@
#!/usr/bin/env bash
# The base model is pretty good overall. It has good punctuation inserting and catches most words.
# Tiny is fast and often has correct grammar, but it misses a lot of words, especially when the
# source isn't loud or is muffled.
#
# Small and medium models can do better word detection at times, but suffer from a lack of punctuation.
# Medium is particularly bad and often excludes periods and commas.
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
# Will return a symlink path in its expanded form. If the path's root is the
# home directory symbol "~" then it'll be replaced by the full home path.
expand_path() {
local ret="$1"
IFS="/" read -ra parts <<< "$ret"
if [[ "${parts[0]}" == "~" ]]; then
ret="$HOME"
for ((i=1; i < ${#parts[@]}; i++))
do
ret="$ret/${parts[$i]}"
done
fi
ret=$(readlink -m "$ret")
echo $ret
}
input_wav="$1"
output_name_without_ext="$2"
model="$3"
threads=$4
# 4 seems to be the sweet spot for most models, except medium might be faster with 8.
default_thread_count=4
if [[ $input_wav == "" || $output_name_without_ext == "" || $model == "" ]]; then
printf "${BOLD}${RED}Usage: $0 <input.wav> <output name without extension> <model name> <optional: thread count>${NORMAL}\n"
exit 1
fi
if [[ ! -f "$input_wav" ]]; then
printf "${RED}${BOLD}Input file \"$input_wav\" doesn't exist!\n${NORMAL}"
exit 1
fi
if [[ $threads == "" ]]; then
threads=$default_thread_count
fi
output_name="$output_name_without_ext.${model}"
# 1 core 31 threads has very fast pcm_to_mel conversion and then just one core doing most of the work. You get more accurate results this way.
# 2 core 16 is about half the time but it can have errors where the two pieces come together. This only gets more likely as the core count is increased.
# 8 threads, 4 cores is good too for tiny,small and 2 threads, 4 cores for medium.
threads=31 #keep a thread for me
cores=1
printf "\n${YELLOW}${BOLD}Transcribing $input_wav | model: $model | cores: $cores | threads: $threads | output: $output_name ${NORMAL}\n"
whisper_fullname="$(expand_path $(which whisper.exe))"
whisper_path="$(dirname $whisper_fullname)"
models_path="$whisper_path/models"
whisper.exe --processors ${cores} --threads ${threads} -m "$models_path/ggml-${model}.en.bin" -otxt -osrt -f "$input_wav" -of "$output_name" --print-colors --print-progress
error=$?
if [[ error -eq 0 ]]; then
printf "${GREEN}${BOLD}Done transcribing $input_wav | model: $model | cores: $cores | threads: $threads | output: $output_name${NORMAL}\n"
else
printf "${GREEN}${BOLD}Error while transcribing $input_wav | model: $model | cores: $cores | threads: $threads | output: $output_name${NORMAL}\n"
fi

View File

@@ -0,0 +1,65 @@
#!/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
input_video="$1"
output_name_without_ext="$2"
shift 2
models=("$@")
if [[ $input_video == "" || $output_name_without_ext == "" || ${#models[@]} -eq 0 ]]; then
printf "${BOLD}${RED}Usage: $0 <input.mp4> <output name without extension> <list of model names to use>${NORMAL}\n"
exit 1
fi
model_csv=$(IFS=_ ; echo "${models[*]}")
wav_name="${output_name_without_ext}_${model_csv}_${RANDOM}"
# Add extension if not provided.
input_basename=$(basename -- "$wav_name")
input_extension="${input_basename##*.}"
if [[ input_extension != "wav" ]]; then
wav_name="${wav_name}.wav"
fi
extract-16bit-wav-from-video "$input_video" "$wav_name"
if [[ $? == 1 ]]; then exit 1; fi
for model in "$@"; do
# Tweak thread count based on model size.
thread_count=4
if [[ $model == "medium" ]]; then
thread_count=8
fi
transcribe-audio "$wav_name" "$output_name_without_ext" "${model}" $thread_count
if [[ $? == 1 ]]; then
printf "${RED}${BOLD}Saving the audio file \"$wav_name\" in case you want to reuse it for debugging.\n${NORMAL}"
exit 1
fi
done
rm "$wav_name"

View File

@@ -0,0 +1,2 @@
#!/usr/bin/env bash
transcribe-video "$1" "$2" "base"

View File

@@ -0,0 +1,2 @@
#!/usr/bin/env bash
transcribe-video "$1" "$2" "medium"

View File

@@ -0,0 +1,2 @@
#!/usr/bin/env bash
transcribe-video "$1" "$2" "small"

View File

@@ -0,0 +1,2 @@
#!/usr/bin/env bash
transcribe-video "$1" "$2" "tiny"

View File

@@ -0,0 +1,48 @@
#!/usr/bin/env bash
# Reencodes the video with a more accurate length.
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
filename=$(basename -- "$1")
output_name="$2"
start_time="$3"
end_time="$4"
if [[ $filename == "" || $output_name == "" || $start_time == "" || $end_time == "" ]]; then
printf "${BOLD}${RED}Usage: $0 <filename> <output name> <start time HH:MM:SS> <end time HH:MM:SS>${NORMAL}\n"
exit 1
fi
extension="${filename##*.}"
filename="${filename%.*}"
output="${output_name}.$extension"
timing_args="-ss $start_time -to $end_time"
printf "\n${YELLOW}${BOLD}Trimming '$filename.$extension' | output: $output | start: $start_time | end: $end_time${NORMAL}\n"
ffmpeg -y -stats -loglevel level+error $timing_args -accurate_seek -i "$filename.$extension" -c:v libx264 -c:a copy "$output"
printf "\n${GREEN}${BOLD}Finished trimming${NORMAL}\n\n"

View File

@@ -40,7 +40,7 @@ timing_args="-ss $start_time -to $end_time"
printf "\n${YELLOW}${BOLD}Trimming '$filename.$extension' | output: $output | start: $start_time | end: $end_time${NORMAL}\n"
ffmpeg -y -stats -loglevel level+error $timing_args -i "$filename.$extension" -c:a copy -c:v copy "$output"
ffmpeg -y -stats -loglevel level+error $timing_args -i "$filename.$extension" -c copy "$output"
printf "\n${GREEN}${BOLD}Finished trimming${NORMAL}\n\n"

View File

@@ -2,8 +2,8 @@
# If you're getting signature errors, check out https://www.msys2.org/news/#2020-06-29-new-packagers and/or other news posts.
source "$HOME/.dotfiles/script_helpers/printing.sh"
source "$HOME/.dotfiles/script_helpers/platform.sh"
source "$HOME/dotfiles/script_helpers/printing.sh"
source "$HOME/dotfiles/script_helpers/platform.sh"
set -e

89
install → dotfiles/install Executable file → Normal file
View File

@@ -4,7 +4,7 @@ if [[ $(uname) == 'Darwin' ]]; then
if ! command -v brew &>/dev/null
then
# We need to update bash, so we'll start with setting up homebrew.
./osx/pre_install
./macos/pre_install
exit
fi
fi
@@ -52,31 +52,6 @@ setup_zsh() {
if [[ $is_linux -eq 1 ]]; then
sudo apt install zsh
fi
make_link .dotfiles/zsh/core .zsh
FILES=()
FILES+=('zshrc')
FILES+=('zlogin')
for file in "${FILES[@]}"
do
make_link .dotfiles/zsh/$file .$file
done
}
setup_bash() {
printf "${MAGENTA}==> ${NORMAL}Setting up bash...\n"
FILES=()
FILES+=('bashrc')
FILES+=('bash_profile')
FILES+=('inputrc')
for file in "${FILES[@]}"
do
make_link .dotfiles/bash/$file .$file
done
}
####################################################################################################
@@ -85,40 +60,6 @@ setup_bash() {
pushd "$HOME" &>/dev/null
make_link $dotfiles_dir .dotfiles 1 # expand source path in case we're reinstalling and the cwd is a symlink.
if [[ $is_windows -eq 1 ]]; then
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
make_link .dotfiles/vim .vim
fi
FILES=()
FILES+=('env.loader')
FILES+=('aliases')
FILES+=('gitconfig')
FILES+=('vimrc')
FILES+=('curlrc')
for file in "${FILES[@]}"
do
make_link .dotfiles/$file .$file
done
set +e
git_comp_filename=".git-completion.bash"
printf "${MAGENTA}==> ${NORMAL}Downloading Git completion list to ${YELLOW}$PWD/$git_comp_filename${NORMAL}\n"
@@ -129,37 +70,19 @@ set -e
# Setup platform files
#########################
if [[ $is_windows -eq 1 ]]; then
printf "\n${BOLD}Setting up Windows${NORMAL}\n\n"
os_name="windows"
# Already using bash if running msys2.
setup_bash
elif [[ $is_macos -eq 1 ]]; then
if [[ $is_macos -eq 1 ]]; then
printf "\n${BOLD}Setting up MacOS${NORMAL}\n\n"
os_name="osx"
$dotfiles_dir/macos/install
# might just switch back to bash since the zsh stuff is ancient.
setup_zsh
setup_bash
use_shell zsh
elif [[ $is_linux -eq 1 ]]; then
printf "\n${BOLD}Setting up Linux${NORMAL}\n\n"
os_name="linux"
setup_zsh
setup_bash
$dotfiles_dir/linux/install
use_shell bash
fi
if [[ $os_name != "" ]]; then
if [ -f .dotfiles/$os_name/env.platform ]; then
make_link .dotfiles/$os_name/env.platform .env.platform
fi
if [ -f .dotfiles/$os_name/gitconfig.platform ]; then
make_link .dotfiles/$os_name/gitconfig.platform .gitconfig.platform
fi
$dotfiles_dir/$os_name/install
fi
popd "$HOME" &>/dev/null
printf "${BOLD}${GREEN}Done!${NORMAL}\n"

Some files were not shown because too many files have changed in this diff Show More