diff --git a/README.md b/README.md index 8094e9e..3d2090f 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,38 @@ -# bash-scripts -A collection of useful bash scripts for linux +# Bash scripts +A collection of (useful) bash scripts for Linux. + +## How to use + + 1. Download the script you want. + 2. Run ``chmod +x script.sh`` to make it executable + 3. Run it with ``./script.sh`` + +## buildpdf.sh + +A script for automatically creating PDf files from a latex document. You can set the amounts of builds and the time between the builds. + +**Usage:** ``./buildpdf.sh filename [build amount] [time between builds in s]`` + +## intellij-hidpi.sh + +This is a small script for enabling and disabling HiDPI support on IntelliJ IDEA Community Edition on every Linux distribution where IntelliJ is installed in /usr/share/intellijidea-ce/. If the installation is somewhere else you have to change the variable IDEA_PATH. + +**Usage:** + + - Help: ``./intellij-hidpi.sh -h`` + - Enable ``./intellij-hidpi.sh -e`` + - Disable ``./intellij-hidpi.sh -d`` + +## android-studio-hidpi.sh + +This is a small script for enabling and disabling HiDPI support in Android Stuido on every linux distribution where Android Stuido is installed in /opt/android-studio. If the installation is somewhere else you have to change the variable STUDIO_PATH. + +**Usage:** + + - Help: ``./android-studio-hidpi.sh -h`` + - Enable ``./android-studio-hidpi.sh -e`` + - Disable ``./android-studio-hidpi.sh -d`` + +## License + +Each script is licensed under GNU GPL v3.0. diff --git a/android-studio-hidpi.sh b/android-studio-hidpi.sh new file mode 100644 index 0000000..8654f29 --- /dev/null +++ b/android-studio-hidpi.sh @@ -0,0 +1,75 @@ +#!/bin/bash +# This is a small script for enabling and disabling HiDPI support in Android Stuido on every Linux distribution where Android Stuido is installed in /opt/android-studio. If the installation is somewhere else you have to change the variable STUDIO_PATH. +# Marcel Michael Kapfer +# 27 May 2015 +# GNU GPL v3.0 -> Feel free to re-distribute or fork it + +## Android Stuido path +STUDIO_PATH="/opt/android-studio/bin" + +## Enable HiDPI +function enable_hidpi { + sudo echo "-Dhidpi=true" >> $STUDIO_PATH/stuido.vmoptions + sudo echo "-Dhidpi=true" >> $STUDIO_PATH/studio64.vmoptions + echo "HiDPI enabled" + exit +} + +## Disable HiDPI +function disable_hidpi { + idea=$(sed '/-Dhidpi=true/d' $STUDIO_PATH/idea.vmoptions) + idea64=$(sed '/-Dhidpi=true/d' $STUDIO_PATH/idea64.vmoptions) + sudo echo "$idea" > $STUDIO_PATH/studio.vmoptions + sudo echo "$idea64" > $STUDIO_PATH/studio64.vmoptions + echo "HiDPI disabled" + exit +} + +## Usage +usage=$( +cat < Feel free to re-distribute it or fork it +if [[ -z "$1" ]]; then + echo "Usage: ./buildpdf.sh filename [build amount] [time between builds in s]" + exit 1 +else + filename=$1 +fi +if [[ -z "$2" ]]; then + builds=1 +else + builds=$2 +fi +if [[ -z "$3" ]]; then + sleeptime=120 +else + sleeptime=$3 +fi +for ((i=1; i<=$builds; ++i)) ; +do + pdflatex $filename + echo "Build $i ready" + if (( i < builds )); then + echo "Waiting $sleeptime seconds - then build again" + sleep $sleeptime + fi +done diff --git a/intellij-hidpi.sh b/intellij-hidpi.sh new file mode 100755 index 0000000..9c476b4 --- /dev/null +++ b/intellij-hidpi.sh @@ -0,0 +1,75 @@ +#!/bin/bash +# This is a small script for enabling and disabling HiDPI support on IntelliJ IDEA Community Edition on every Linux distribution where IntelliJ is installed in /usr/share/intellijidea-ce/. If the installation is somewhere else you have to change the variable IDEA_PATH. +# Marcel Michael Kapfer +# 27 May 2015 +# GNU GPL v3.0 -> Feel free to re-distribute or fork it + +## IntelliJ path +IDEA_PATH="/usr/share/intellijidea-ce/bin" + +## Enable HiDPI +function enable_hidpi { + sudo echo "-Dhidpi=true" >> $IDEA_PATH/idea.vmoptions + sudo echo "-Dhidpi=true" >> $IDEA_PATH/idea64.vmoptions + echo "HiDPI enabled" + exit +} + +## Disable HiDPI +function disable_hidpi { + idea=$(sed '/-Dhidpi=true/d' $IDEA_PATH/idea.vmoptions) + idea64=$(sed '/-Dhidpi=true/d' $IDEA_PATH/idea64.vmoptions) + sudo echo "$idea" > $IDEA_PATH/idea.vmoptions + sudo echo "$idea64" > $IDEA_PATH/idea64.vmoptions + echo "HiDPI disabled" + exit +} + +## Usage +usage=$( +cat <