This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
get_git_status() { | |
git_status=$(git status -s -u -v 2>/dev/null) | |
if [[ -z "$git_status" ]]; then return 0; fi | |
modified=$(echo "$git_status" | grep '^ M ' | wc -l) | |
deleted=$(echo "$git_status" | grep '^ D ' | wc -l) | |
untracked=$(echo "$git_status" | grep '^?? ' | wc -l) | |
echo "(~$modified -$deleted +$untracked) " | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Sets the color of next text output to be a random color based on hostname's md5 hash. | |
# (If the terminal supports true colour (RGB) colors.) | |
set_host_based_color() { | |
HOSTHASH=$(hostname | md5sum) | |
printf "\x1b[38;2;%d;%d;%dm" 0x${HOSTHASH:0:2} 0x${HOSTHASH:2:2} 0x${HOSTHASH:4:2} | |
} | |
# Example usage: | |
# PS1="[\$(set_host_based_color)\$(hostname)\033[0m]: " |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Use this to enable debugging for current terminal session. | |
# export XDEBUG_CONFIG="idekey=whatever" | |
[XDebug] | |
xdebug.remote_enable=1 | |
xdebug.remote_autostart=0 | |
xdebug.profiler_output_dir=/mnt/d/_produkce/_xdebug_profiles/ | |
xdebug.profiler_output_name=callgrind.%t.out | |
xdebug.profiler_enable_trigger=1 | |
#xdebug.idekey="asd" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rsync -e ssh -avzP --inplace (<src_host>:)<src_path> (<target_host>:)<target_path> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# smuuf.bashrc | |
# Prompt formatting | |
# 10:20:49 /etc | |
# [smuuf@smuuf-xubuntu]$ | |
parse_git_branch() { | |
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1) /' | |
} | |
NC="$(tput sgr0)" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Best to put this in your .bashrc | |
# .wav extension will be replaced with .mp3 automatically. | |
# Usage: wavtomp3 lorem_ipsum.wav | |
function wavtomp3() { | |
ffmpeg -i "$1" -vn -ar 44100 -ac 2 -b:a 320k "${1/.wav/.mp3}" | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Have this in your client WSL1 ".bashrc" file. | |
WSL_DAEMON_DIST_NAME="Alpine" # WSL distribution name which has Docker daemon running in it. | |
export DOCKER_HOST=`wsl.exe -d $WSL_DAEMON_DIST_NAME eval ifconfig | grep -A 1 eth0 | grep -Po "\d+\.\d+\.\d+\.\d+" | head -n1` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This is the name of archive taken from https://downloads.python.org/pypy/ | |
PYPY_VER="pypy3.9-v7.3.11-linux64" | |
PYPY_VER_NUM=`echo ${PYPY_VER} | grep -oP "v(\d\.?)+" | sed -r 's/[v.]//g'` | |
cd ~ | |
mkdir pypy | |
wget https://downloads.python.org/pypy/$PYPY_VER.tar.bz2 && tar -xvjf $PYPY_VER.tar.bz2 | |
rm $PYPY_VER.tar.bz2 | |
mv $PYPY_VER pypy/ | |
sudo ln -s ~/pypy/$PYPY_VER/bin/pypy3 /usr/bin/pypy3-$PYPY_VER_NUM; chmod +x /usr/bin/pypy3-$PYPY_VER_NUM |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# After installing MariaDB via apt, run this: | |
## Fix MySQL (MariaDB) | |
if [ ! -f "/etc/init.d/mysql" ]; then | |
sudo cp /usr/share/mysql/mysql.init /etc/init.d/mysql | |
sudo chmod a+x /etc/init.d/mysql | |
sudo service mysql restart | |
sudo mysql_secure_installation | |
sudo service mysql restart | |
fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Usage: | |
# ./a2manage.sh a2dismod proxy.* | |
# ./a2manage.sh a2enmod proxy proxy_fcgi ssl | |
MODS_A_CONF_PATH="/etc/apache2/*.conf" | |
MODS_B_CONF_PATH="/etc/apache2/conf.d/*.conf" | |
function a2enmod { |