Skip to content

Instantly share code, notes, and snippets.

View germanow's full-sized avatar
:octocat:

Ivan Hermanov germanow

:octocat:
View GitHub Profile
@germanow
germanow / ubuntu_customization.md
Last active May 9, 2022 09:25
for ubuntu 20.04

Minimize on click:

gsettings set org.gnome.shell.extensions.dash-to-dock click-action 'minimize'

Back to default:

gsettings reset org.gnome.shell.extensions.dash-to-dock click-action
@germanow
germanow / fix_brightness_legion.txt
Created May 1, 2022 16:00
Fix brightness on Lenovo legion 5 15ACH6
# from https://www.reddit.com/r/linux_gaming/comments/kb95g8/brightness_and_touchpad_lenovo_legion_5_ubuntu/
sudo nano /etc/default/grub
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash nvidia.NVreg_RegistryDwords=EnableBrightnessControl=1"
sudo update-grub2
sudo reboot
@germanow
germanow / queue-worker.service
Created August 18, 2021 07:58
Example of systemd service for yii2-queue
[Unit]
Description=queue Worker Number %i
After=network.target
[Service]
Type=simple
User=user
WorkingDirectory=/path/to/project
PIDFile=/var/run/queue.%i
@germanow
germanow / geoserver.service
Created July 1, 2021 11:20
Example systemd configuration for geoserver
[Unit]
Description=Geoserver
After=multi-user.target
[Service]
Type=simple
User=ivan
WorkingDirectory=/home/ivan/work/geoserver-2.18.1-bin/bin
ExecStart=/bin/bash /home/ivan/work/geoserver-2.18.1-bin/bin/startup.sh
Restart=always
RestartSec=5
@germanow
germanow / self-update.sh
Last active June 17, 2021 06:00
Deploy laravel
#!/usr/bin/env bash
# change working directory to self-update dir
parent_path=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P )
cd "$parent_path"
git pull &&
composer install --optimize-autoloader --no-dev &&
php artisan migrate &&
php artisan route:clear &&
@germanow
germanow / ssh_tunnel.sh
Created June 3, 2021 07:37
SSH tunnel for postgres
# Once you run the command, you’ll be prompted to enter the remote SSH user password.
# Once entered, you will be logged into the remote server, and the SSH tunnel will be established.
# link https://linuxize.com/post/how-to-setup-ssh-tunneling/
ssh -L 127.0.0.1:5432:127.0.0.1:5432 -p 2211 username@host.com
@germanow
germanow / composer_in_docker.sh
Last active April 27, 2021 04:30
Docker composer install
docker run --rm --interactive --tty \
--volume $PWD:/app \
--user $(id -u):$(id -g) \
composer install --ignore-platform-reqs --no-scripts
@germanow
germanow / second_hdd.sh
Created April 16, 2021 07:54
Mount second hdd linux mint
# get uuid
sudo blkid
sudo mkdir /disk2
sudo chmod 1777 /disk2
# At the end of this file add an entry like (where you replace 00000000-0000-0000-0000-000000000000 with the UUID the blkid command gave you):
# UUID=00000000-0000-0000-0000-000000000000 /disk2 ext4 defaults 0 2
sudo edit /etc/fstab
@germanow
germanow / php.ini
Created April 16, 2021 06:43
var_dump() display full object
; Взято отсюда https://www.kobzarev.com/programming/var-dump-xdebug/
; в разумных пределах
xdebug.var_display_max_depth = 10
xdebug.var_display_max_children = 256
xdebug.var_display_max_data = 1024
; без лимитов
; (максимальный уровень вложенности 1023)
xdebug.var_display_max_depth = -1
xdebug.var_display_max_children = -1
@germanow
germanow / simulation.py
Created March 10, 2021 05:53
Решение задачи про шарды на stepik.org
from intervals import IntInterval
from infinity import inf
def request_range(now, n):
if n < now/10:
return IntInterval.closed_open(now-(n+1)*10, now-n*10)
else:
return IntInterval([max(0, now-10), now])
'''