Skip to content

Instantly share code, notes, and snippets.

View prianichnikov's full-sized avatar

Maksim Prianichnikov prianichnikov

View GitHub Profile
# Обновление системы и пакетов
apt-get update
apt-get upgrade -y
# Установка пакетов для сборки softether
apt-get install build-essential libreadline-dev libssl-dev libncurses-dev zlib1g-dev git
# Скачивание репозитория Stable версии
git clone https://github.com/SoftEtherVPN/SoftEtherVPN_Stable.git
# Обновление системы и пакетов
yum update -y
# Установка пакетов для сборки softether
yum install gcc make -y
# Скачивание последней rtm версии
curl http://www.softether-download.com/files/softether/v4.27-9666-beta-2018.04.21-tree/Linux/SoftEther_VPN_Server/64bit_-_Intel_x64_or_AMD64/softether-vpnserver-v4.27-9666-beta-2018.04.21-linux-x64-64bit.tar.gz \
-o softether-vpnserver-v4.27-9666-beta-2018.04.21-linux-x64-64bit.tar.gz
cd /opt/vpnserver/
# Проверка сервера
./vpncmd /TOOLS /CMD Check
# Отключение Keep Alive Internet Connection
./vpncmd localhost:5555 /SERVER /CMD KeepDisable
# Выбор более устойчивого алгоримта шифрования чем установлен по умолчанию
./vpncmd localhost:5555 /SERVER /CMD ServerCipherSet AES256-SHA
cd /opt/vpnserver/
# Включение SecureNat
./vpncmd localhost:5555 /SERVER /HUB:VPN /CMD SecureNatEnable
# Установка mac адреса, ip адреса и маски хаба, где:
# /IP - ip-адрес вируального роутера хаба
# /MASK - его маска
# /MAC - MAC-адрес
./vpncmd localhost:5555 /SERVER /HUB:VPN /CMD SecureNatHostSet /MAC:00-11-22-33-44-55 /IP:192.168.234.1 /MASK:255.255.255.0
cd /opt/vpnserver
# Создаем новый tap-интерфейс, где:
# VPN - название созданного хаба,
# /DEVICE - часть названия tap-интерфейса, которое будет добсавлено к "tap_"
./vpncmd localhost:5555 /SERVER /CMD BridgeCreate VPN /DEVICE:vpn /TAP:yes
# Проверяем ново-созданный интерфейс
# Status должен быть "Operating"
./vpncmd localhost:5555 /SERVER /CMD BridgeList
[Unit]
Description=SoftEther VPN Server
After=network.target auditd.service
ConditionPathExists=!/opt/vpnserver/do_not_run
[Service]
Type=forking
EnvironmentFile=-/opt/vpnserver
ExecStart=/opt/vpnserver/vpnserver start
ExecStartPost=/bin/sleep 3s
@prianichnikov
prianichnikov / check-internet-speed.txt
Last active November 16, 2023 06:57
Check internet speed
# iperf3 server start
iperf3 -s
# standard client check from client to server
iperf3 -t 30 -c <IP>
# reverse client check from server to client
iperf3 -t 30 -R -c <IP>
# public iperf servers
@prianichnikov
prianichnikov / Algo_MovingAverage.java
Last active June 27, 2023 15:21
Moving average implementation
public class MovingAverage {
private final int[] array;
private int index;
private long sum;
public MovingAverage(int size) {
this.array = new int[size];
this.index = 0;
}
/*
Longest Common Prefix
Example 1:
Input: strs = ["flower","flow","flight"]
Output: "fl"
Example 2:
Input: strs = ["dog","racecar","car"]
Output: ""
@prianichnikov
prianichnikov / Solution.java
Created November 7, 2023 14:41
Technical interview task
/*
We have a two-dimensional board game involving snakes. The board has two types of squares on it: +'s represent
impassable squares where snakes cannot go, and 0's represent squares through which snakes can move.
Snakes can only enter on the edges of the board, and each snake can move in only one direction.
We'd like to find the places where a snake can pass through the entire board, moving in a straight line.
Here is an example board:
col--> 0 1 2 3 4 5 6
+----------------------