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 / 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"
@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 / 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 / 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 / dism-clean-win-sxs.bat
Last active November 3, 2018 10:11
Clean Up the WinSxS Folder via DISM
:: Removes all superseded versions of every component in the component store.
:: All existing service packs and updates cannot be uninstalled after this command is completed.
:: This will not block the uninstallation of future service packs or updates.
dism /online /Cleanup-Image /StartComponentCleanup /ResetBase
:: Reduces the amount of space used by a Service Pack.
:: The service pack cannot be uninstalled after this command is completed.
dism /online /Cleanup-Image /SPSuperseded
@salaros
salaros / README-Template.md
Created November 20, 2017 00:07 — forked from PurpleBooth/README-Template.md
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

@salaros
salaros / Makefile
Last active November 13, 2017 00:27
Add Sphinx -> HTML document generation to a PHP project
# Minimal makefile for Sphinx documentation
#
# You can set these variables from the command line.
SPHINXOPTS =
SPHINXBUILD = sphinx-build
SOURCEDIR = .
BUILDDIR = _build
ROOT_DIR := $(dir $(abspath $(lastword $(MAKEFILE_LIST))))
#!/bin/bash
gnomeshell-extension-manage --install --version 3.26 --extension-id 15 # Alternate Alt+Tab (Windows 7 style with thumbnails)
gnomeshell-extension-manage --install --version 3.26 --extension-id 7 # Removable Drive Menu
gnomeshell-extension-manage --install --version 3.26 --extension-id 55 # 55/media-player-indicator
# gnomeshell-extension-manage --install --extension-id 921 # 921/multi-monitors-add-on/
gnomeshell-extension-manage --install --extension-id 118 # 118/no-topleft-hot-corner/
gnomeshell-extension-manage --install --version 3.26 --extension-id 750 # 750/openweather/
gnomeshell-extension-manage --install --extension-id 1218 # 1218/printers/
gnomeshell-extension-manage --install --version 3.26 --extension-id 19 # 19/user-themes/
#!/bin/bash
PROGNAME=${0##*/}
INPUT=''
QUIET='0'
NOSTATS='0'
max_input_size=0
max_output_size=0
usage()
# TODO use a dedicated backup user, protect gzip file with password etc
echo "/var/backups/all-databases.sql.gz {
daily
rotate 8
nocompress
create 640 root adm
postrotate
mysqldump -uroot --all-databases > /var/backups/all-databases.sql --single-transaction
gzip -9f /var/backups/all-databases.sql.sql
endscript