Skip to content

Instantly share code, notes, and snippets.

View rhamdeew's full-sized avatar
🏠
Working from home

Rail rhamdeew

🏠
Working from home
View GitHub Profile
@rhamdeew
rhamdeew / backup-excludes.conf
Last active June 23, 2023 12:54
Vesta CP. Example of /usr/local/vesta/data/users/%user%/backup-excludes.conf to correctly ignore dirs for multiple domains
WEB='site1.ru:public_html/bitrix/cache:public_html/bitrix/backup:public_html/upload/tmp:public_html/upload/resize_cache,site2.ru:public_html/bitrix/cache:public_html/bitrix/backup:public_html/upload/tmp:public_html/upload/resize_cache'
DNS=''
MAIL=''
DB=''
CRON=''
USER=''
@rhamdeew
rhamdeew / ruby.json
Last active November 29, 2021 10:39
Ruby snippets for VS Code
{
"Byebug": {
"prefix": "bb",
"body": [
"byebug",
],
"description": "Place debugger breakpoint"
},
"Screenshot and save": {
"prefix": "ss",
@rhamdeew
rhamdeew / gist:3e3a4b4d134bb876de715fee908ab34f
Created July 9, 2018 14:47
Linux us,ru layout with 3rd level on right alt
setxkbmap -option "lv3:ralt_switch, misc:typo" -option grp:alt_shift_toggle "us,ru"
Понадобилось тут мне быстро скачать готовый образ с CentOS и запустить его в Qemu KVM.
Скачал образ в qcow2, создал виртуалку с этим образом, запустил. Все вроде бы ок, но пароль рута отсутствует.
В официальной документации от RedHat также нигде он не написан, зато предлагают подправить опции в Grub и загрузиться
в Single-mode. Этот вариант я попробовал, но в итоге все равно получил запрос на авторизацию.
Короче беда какая-то...
Оказалось что все это можно очень просто решить при помощи virt-sysprep:

Keybase proof

I hereby claim:

  • I am rhamdeew on github.
  • I am rhamdeew (https://keybase.io/rhamdeew) on keybase.
  • I have a public key whose fingerprint is FE7D 5487 D0E9 264A 18DD A14E 5201 4492 E8E0 032C

To claim this, I am signing this object:

@rhamdeew
rhamdeew / gist:a218aa6fd903fec4c534
Created January 26, 2015 19:14
bitrix .gitignore sample
*.komodoproject
.buildpath
.project
.settings
sitemap*.xml
awstats.*
*.sh
#symlinks
site.ru/bitrix
iptables -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT &&
iptables -A INPUT -p tcp -m tcp --tcp-flags FIN,SYN,RST,PSH,ACK,URG NONE -j DROP &&
iptables -A INPUT -p tcp -m tcp ! --tcp-flags FIN,SYN,RST,ACK SYN -m state --state NEW -j DROP &&
iptables -A INPUT -i lo -j ACCEPT &&
iptables -D INPUT -p tcp -m tcp --dport 21 -j ACCEPT &&
iptables -A INPUT -p tcp -m tcp --dport 80 -j ACCEPT &&
iptables -A INPUT -p tcp -m tcp --dport 443 -j ACCEPT &&
iptables -A INPUT -p tcp -m tcp --dport 1989 -j ACCEPT &&
iptables -A INPUT -p tcp -m tcp --dport 1500 -j ACCEPT &&
iptables -A INPUT -p tcp -m tcp --dport 18080 -j ACCEPT &&
@rhamdeew
rhamdeew / gist:cf583391a2ec5457866a
Created August 18, 2014 14:34
Lftp синхронизация каталога на сервере без перезаливки имеющихся файлов
open login:password@ftp.site.ru
mirror --reverse --delete --use-cache --verbose --only-missing --allow-chown --allow-suid --no-umask --parallel=2 --dereference /localdir dir
exit
@rhamdeew
rhamdeew / README
Last active May 3, 2016 17:01
rhamdeew/lamp description
1. sudo docker pull rhamdeew/lamp
2. sudo docker run -v /your_empty_project_path/:/var/www/srv/ -p 80:80 -t -i rhamdeew/lamp /bin/bash
3. in container: cp -R /var/www/example /var/www/srv
4. in container: cd /var/www/srv/
5. in container: ./start.sh
6. open http://localhost/1.php
Your project structure
projectname/
@rhamdeew
rhamdeew / selectel_split_backup.sh
Created August 5, 2014 12:03
Backup script for selectel with split large files (+4Gb)
#!/bin/bash
#sync directories struct
rsync -a --include='*/' --exclude='*' /var/backups/local/ /var/backups/selectel
find /var/backups/local/ -name "admin-1_full*" -mtime -7 -size -4000M > /tmp/small_files.lst
for i in `cat /tmp/small_files.lst`; do ln -s $i `echo $i | sed 's/local/selectel/g'`; done;
find /var/backups/local/ -name "admin-1_full*" -mtime -7 -size +4000M > /tmp/large_files.lst
for i in `cat /tmp/large_files.lst`; do split --bytes=4000m $i `echo $i | sed 's/local/selectel/g'`; done;