Skip to content

Instantly share code, notes, and snippets.

View eignatov's full-sized avatar
💻
typing...

eignatov

💻
typing...
View GitHub Profile
@eignatov
eignatov / loadbalance_failover.rsc
Created October 31, 2023 13:12 — forked from gladiopeace/loadbalance_failover.rsc
mikrotik loadbalance and failover script
/ ip address
add address=192.168.0.1/24 network=192.168.0.0 broadcast=192.168.0.255 interface=LAN
add address=10.111.0.2/24 network=10.111.0.0 broadcast=10.111.0.255 interface=ISP1
add address=10.112.0.2/24 network=10.112.0.0 broadcast=10.112.0.255 interface=ISP2
/ ip firewall mangle
add chain=prerouting dst-address=10.111.0.0/24 action=accept in-interface=LAN
add chain=prerouting dst-address=10.112.0.0/24 action=accept in-interface=LAN
add chain=prerouting in-interface=ISP1 connection-mark=no-mark action=mark-connection \
new-connection-mark=ISP1_conn
@eignatov
eignatov / unifi_container_rb5009.md
Created October 16, 2023 11:51 — forked from marfillaster/unifi_container_rb5009.md
Running Unifi Network Controller as a container in MikroTik ROSv7 RB5009

Requirement

  • USB flash drive - this is where the container filesystem will be persisted

Set-up docker bridge network

/interface bridge add name=docker

Set-up veth to be used by container

@eignatov
eignatov / doublevpn.md
Created January 16, 2023 11:12 — forked from gushmazuko/doublevpn.md
Double VPN with OpenVPN

Двойной VPN на основе OpenVPN

Сначало настроим второй сервер:

Шаг 1. Установка OpenVPN

sudo apt update
sudo apt install openvpn easy-rsa
@eignatov
eignatov / accounts.list
Created January 9, 2023 16:35 — forked from onlime/accounts.list
imapsync script to migrate multiple IMAP accounts in a row
# <SRCUSER> <SRCPW> <DSTUSER> <DSTPW>
@eignatov
eignatov / mount_qcow2.md
Created July 4, 2020 09:13 — forked from shamil/mount_qcow2.md
How to mount a qcow2 disk image

How to mount a qcow2 disk image

This is a quick guide to mounting a qcow2 disk images on your host server. This is useful to reset passwords, edit files, or recover something without the virtual machine running.

Step 1 - Enable NBD on the Host

modprobe nbd max_part=8
@eignatov
eignatov / command.sh
Created February 27, 2020 20:09 — forked from sponomarev/command.sh
Remove iTerm2 icon from Dock
# remove
/usr/libexec/PlistBuddy -c 'Add :LSUIElement bool true' /Applications/iTerm.app/Contents/Info.plist
# restore
/usr/libexec/PlistBuddy -c 'Delete :LSUIElement' /Applications/iTerm.app/Contents/Info.plist
@eignatov
eignatov / postgres_ftp_backup.sh
Created February 5, 2020 19:41 — forked from cschell/postgres_ftp_backup.sh
Backup gziped postgresql dump to a ftp server
# shell command:
pg_dump <db_name> -U <db_user> -h <db_host> | gzip | curl -u <ftp_user>:<ftp_password> ftp://<ftp_host>/`date '+%Y-%m-%d_%H-%M'`/db_backup.sql.gz --ftp-create-dirs -T -
# if you want to execute it through cron, be sure to escape all %!
# for crontab:
pg_dump <db_name> -U <db_user> -h <db_host> | gzip | curl -u <ftp_user>:<ftp_password> ftp://<ftp_host>/`date '+\%Y-\%m-\%d_\%H-\%M'`/db_backup.sql.gz --ftp-create-dirs -T -
@eignatov
eignatov / delete_old_backups.sh
Created February 5, 2020 19:41 — forked from cschell/delete_old_backups.sh
Delete backups that are x days old (from ftp server)
lftp -u <ftp_user>,<ftp_password> <ftp_host> -e "rm -rf `date --date="3 days ago" '+%Y-%m-%d_'`*; exit"
# make sure to escape % for cron:
lftp -u <ftp_user>,<ftp_password> <ftp_host> -e "rm -rf `date --date="3 days ago" '+\%Y-\%m-\%d_'`*; exit"
#!/bin/bash
# the source: http://serverfault.com/questions/515833/how-to-remove-private-key-password-from-pkcs12-container
if [ $# -ne 2 ]
then
echo "Usage: `basename $0` YourPKCSFile YourPKCSPassword"
exit $E_BADARGS
fi
@eignatov
eignatov / curl_create_repo_github
Created December 11, 2017 10:42 — forked from chrisross/curl_create_repo_github
A set of shell commands to quickly remotely create a github repo, init/add all/commit in the current directory and push to the aforementioned remote. (using Github's Repo API v3 and cURL)
curl -u <username_here> https://api.github.com/user/repos -d '{"name":"curltest", "description": "testing description"}'
=> Enter passphrase:
// Example test case(below):
cd <local_repo_dir_path>
mkdir curltest
cd curltest
git init
touch curltest.txt
subl& culrtest.txt