Skip to content

Instantly share code, notes, and snippets.

@yuceltoluyag
Last active November 30, 2022 09:56
Show Gist options
  • Save yuceltoluyag/22edc62136ff661718050aca16af0d8e to your computer and use it in GitHub Desktop.
Save yuceltoluyag/22edc62136ff661718050aca16af0d8e to your computer and use it in GitHub Desktop.
While downloading files larger than 2gb from Github, it was giving an error and the download was being reset. This is how I solved the problem, you can delete the fonts you don't want to use. If you want to delete Windows compatible fonts, delete lines 73 and 74 and replace with find "$fonts_dir" -name '*Windows Compatible*' -delete
#!/bin/bash
declare -a fonts=(
"3270"
Agave
AnonymousPro
Arimo
AurulentSansMono
BigBlueTerminal
BitstreamVeraSansMono
CascadiaCode
CodeNewRoman
Cousine
DaddyTimeMono
DejaVuSansMono
DroidSansMono
FantasqueSansMono
FiraCode
FiraMono
Go-Mono
Gohu
Hack
Hasklig
HeavyData
Hermit
iA-Writer
IBMPlexMono
Inconsolata
InconsolataGo
InconsolataLGC
Iosevka
JetBrainsMono
Lekton
LiberationMono
Meslo
Monofur
Monoid
Mononoki
MPlus
NerdFontsSymbolsOnly
Noto
OpenDyslexic
Overpass
ProFont
ProggyClean
RobotoMono
ShareTechMono
SourceCodePro
SpaceMono
Terminus
Tinos
Ubuntu
UbuntuMono
VictorMono
)
version='2.2.2'
fonts_dir="${HOME}/.local/share/fonts"
if [[ ! -d "$fonts_dir" ]]; then
mkdir -p "$fonts_dir"
fi
for font in "${fonts[@]}"; do
zip_file="${font}.zip"
download_url="https://github.com/ryanoasis/nerd-fonts/releases/download/v${version}/${zip_file}"
echo "Downloading $download_url"
wget "$download_url"
unzip -o "$zip_file" -d "$fonts_dir"
rm "$zip_file"
done
#find "$fonts_dir" -iname "*.otf" -not -iname "*Windows Compatible.otf" -execdir install -Dm644 {} "${HOME}/.local/share/fonts/OTF/{}" \;
#find "$fonts_dir" -iname "*.ttf" -not -iname "*Windows Compatible.ttf" -execdir install -Dm644 {} "${HOME}/.local/share/fonts/TTF/{}" \;
find "$fonts_dir" -name '*Windows Compatible*' -delete
fc-cache -fv
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment