Initial release

This commit is contained in:
mmk2410 2015-05-27 19:41:08 +02:00
parent f53ff4612a
commit 2c263dd2bd
4 changed files with 220 additions and 2 deletions

View file

@ -1,2 +1,38 @@
# bash-scripts # Bash scripts
A collection of useful bash scripts for linux 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.

75
android-studio-hidpi.sh Normal file
View file

@ -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 <<EOF
Usage:
Enable HiDPI support:
--enable
or
-e
Disabling HiDPI support:
--disable
or
-d
Help (prints this)
--help
or
-h
EOF
)
## Options
### Runns if no argument is given
if [[ -z "$1" ]]
then
echo
echo "$usage"
exit
fi
### Runs if an argument is given
until [[ $1 == -- ]]; do
case $1 in
-e | --enable)
enable_hidpi
;;
-d | --disable)
disable_hidpi
;;
-h | --help)
echo "$usage"
exit
;;
esac
done

32
buildpdf.sh Executable file
View file

@ -0,0 +1,32 @@
#!/bin/bash
# A script for automatically creating PDf files from a latex document
# You can set the amounts of builds and the time between these builds
# Usage: ./buildpdf.sh filename [build amount] [time between builds in s]
# Marcel Michael Kapfer
# 6th January 2015
# GNU GPL v3.0 -> 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

75
intellij-hidpi.sh Executable file
View file

@ -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 <<EOF
Usage:
Enable HiDPI support:
--enable
or
-e
Disabling HiDPI support:
--disable
or
-d
Help (prints this)
--help
or
-h
EOF
)
## Options
### Runns if no argument is given
if [[ -z "$1" ]]
then
echo
echo "$usage"
exit
fi
### Runs if an argument is given
until [[ $1 == -- ]]; do
case $1 in
-e | --enable)
enable_hidpi
;;
-d | --disable)
disable_hidpi
;;
-h | --help)
echo "$usage"
exit
;;
esac
done