Skip to content

Instantly share code, notes, and snippets.

View salaros's full-sized avatar
🎉
Making magic happen

Yaroslav Zhmayev salaros

🎉
Making magic happen
View GitHub Profile
@salaros
salaros / remove-cache-folders.sh
Last active January 1, 2018 20:18
Remove cache folders in a given path
find /home/salaros -regextype posix-egrep -iregex "(packages-|shaders_|Shader|repository-|_ca|GPU|v3-|.)+?cache" -type d -exec rm -rfv "{}" \;
@salaros
salaros / split_combine_pdf.sh
Created January 2, 2018 23:54
Splits PDF into images (one image per page), then re-combines pages into new PDF
## sudo apt install -qy ghostscript imagemagick
mkdir -pv pages
## gs -dNOPAUSE -dBATCH -sDEVICE=jpeg -r96 -sOutputFile='pages/page-%02d.jpg' 'input.pdf'
gs -dNOPAUSE -dBATCH -sDEVICE=pngalpha -r96 -sOutputFile='pages/page-%02d.png' 'input.pdf'
## convert -adjoin pages/*.png 'output.pdf'
convert -adjoin pages/*.png 'output.pdf'
@salaros
salaros / 01-touchpad.rules
Last active January 23, 2018 18:02
Disable touchpad via udev when mouse is plugged
# Disable touchpad when mouse is plugged
# file: /etc/udev/rules.d/01-touchpad.rules
ACTION=="add", ENV{ID_CLASS}="mouse",ENV{DISPLAY}=":0.0", ENV{XAUTHORITY}="/home/salaros/.Xauthority", RUN+="/bin/sh -c 'xinput disable DELL0767:00\ 06CB:7E92\ Touchpad'"
ACTION=="remove", ENV{ID_CLASS}="mouse", ENV{DISPLAY}=":0.0", ENV{XAUTHORITY}="/home/salaros/.Xauthority", RUN+="/bin/sh -c 'xinput enable DELL0767:00\ 06CB:7E92\ Touchpad'"
@salaros
salaros / etc_default_locale
Created January 24, 2018 05:36
Etc configs
#
LANG=en_US.UTF-8
LC_NUMERIC="be_BY.UTF-8"
LC_TIME="ru_RU.UTF-8"
LC_MONETARY="be_BY.UTF-8"
LC_PAPER="be_BY.UTF-8"
LC_NAME="be_BY.UTF-8"
LC_ADDRESS="be_BY.UTF-8"
LC_TELEPHONE="be_BY.UTF-8"
LC_MEASUREMENT="be_BY.UTF-8"
sudo apt install -y \
jbigkit-bin \
imagemagick \
ghostscript \
inotify-tools
wget https://github.com/xundeenergie/ricoh-sp100/raw/master/ricoh-sp100_0.1.10_all.deb
sudo dpkg -i ricoh-sp100_0.1.10_all.deb && rm -rfv ricoh-sp100_0.1.10_all.deb
@salaros
salaros / arduino-1.8.x-Ubuntu.sh
Created January 27, 2018 19:41
USB libraries needed by Arduino 1.8.x on Ubuntu
apt-get install libusb-0.1-4 libusb-0.1-4:i386
@salaros
salaros / .config__gtk-3.0__gtk.css
Created February 6, 2018 14:56
Tweak Nautilus desktop on Gnome Shell
.nautilus-desktop.nautilus-canvas-item {
color: #ffffff;
text-shadow: 1px 1px 2px rgba(25, 25, 25, 0.75), 1px 1px 2px rgba(25, 25, 25, 0.75);
}
@salaros
salaros / docker_cleanup.sh
Last active December 20, 2018 09:11
Clean up Docker images, containers etc
# Just clean up incomplete images
[[ ! -z $(docker images --filter "dangling=true" -q --no-trunc) ]] && \
docker rmi --force $(docker images --filter "dangling=true" -q --no-trunc)
#Remove unused containers
[[ ! -z $(docker ps -qa --no-trunc --filter "status=exited") ]] && \
docker rm $(docker ps -qa --no-trunc --filter "status=exited")
#!/bin/sh
# Ms Office thumbnailer
# test Ubuntu distribution
DISTRO=$(lsb_release -is 2>/dev/null)
[ "${DISTRO}" != "Ubuntu" ] && { zenity --error --text="This automatic installation script is for Ubuntu only"; exit 1; }
# install tools
sudo apt-get -y install libfile-mimeinfo-perl gvfs-bin unoconv netpbm
@salaros
salaros / password_regex.txt
Last active May 8, 2018 20:03
A good regEx for validating secure passwords
(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[@\.\*\\\/,#$%`|\)\(\]\[=]).{6,25}
* min 6 max 25 characters
* at least one lower-case letter
* at least one upper-case letter
* at least one digit
* at least one "special" character, among these: , . * / \ # $ % ` [ ] ) (