Skip to content

Instantly share code, notes, and snippets.

@Scrik
Scrik / repair-dude.md
Created March 11, 2025 11:47 — forked from bretton/repair-dude.md
Repair Mikrotik Dude database

If you run a Mikrotik Dude instance on CHR, have a lot of devices and years of activity, problems start to arise with errors like:

server status: db failure: disk image is malformed. stop
server status: db failure: database disk image is malformed. stop

The problem might temporarily be resolved by running

#!/bin/bash
@Scrik
Scrik / hosts
Created August 16, 2024 11:11 — forked from consti/hosts
/etc/hosts to block shock sites etc.
# This hosts file is brought to you by Dan Pollock and can be found at
# http://someonewhocares.org/hosts/
# You are free to copy and distribute this file for non-commercial uses,
# as long the original URL and attribution is included.
#<localhost>
127.0.0.1 localhost
127.0.0.1 localhost.localdomain
255.255.255.255 broadcasthost
::1 localhost
def ip2hex(cidr, router):
addr, mask = cidr.split("/")
mask = int(mask)
addr = [("%2s" % hex(int(i))[2:]).replace(" ", "0") for i in addr.split(".") if i != "0"]
parts = mask/8 - len(addr)
if mask%8 > 0:
parts += 1
if parts > 0:
for i in range(int(parts)):
addr.append("00")
SET 1
1. A network ready device is directly connected to a MikroTik RouterBOARD 750 with a correct U.T.P. RJ45 functioning cable. The device is configured with an IPv4 address of 192.168.100.70 using a subnet mask of 255.255.255.252. What will be a valid IPv4 address for the RouterBOARD 750 for a successful connection to the device?
a. 192.168.100.70/255.255.255.252
b. 192.168.100.69/255.255.255.252
c. 192.168.100.71/255.255.255.252
d. 192.168.100.68/255.255.255.252
2. In MikroTik RouterOS, Layer-3 communication between 2 hosts can be achieved by using an address subnet of:
@Scrik
Scrik / my.cnf
Created November 7, 2023 17:27 — forked from fevangelou/my.cnf
Optimized my.cnf configuration for MySQL/MariaDB (on Ubuntu, CentOS, Almalinux etc. servers)
# === Optimized my.cnf configuration for MySQL/MariaDB (on Ubuntu, CentOS, Almalinux etc. servers) ===
#
# by Fotis Evangelou, developer of Engintron (engintron.com)
#
# ~ Updated December 2021 ~
#
#
# The settings provided below are a starting point for a 8-16 GB RAM server with 4-8 CPU cores.
# If you have different resources available you should adjust accordingly to save CPU, RAM & disk I/O usage.
#
@Scrik
Scrik / ntlm_auth.php
Created April 7, 2023 10:25 — forked from inogo/ntlm_auth.php
PHP NTLM Authentication
<?php // by SiMM
$headers = apache_request_headers(); // получаем все заголовки клиента
if (!isset($headers['Authorization'])) { // если заголовка авторизации нет
header('HTTP/1.0 401 Unauthorized'); // требуем от клиента авторизации
header('WWW-Authenticate: NTLM'); // тип требуемой авторизации - NTLM
exit; // завершаем выполнение скрипта
}
// заголовок авторизации от клиента пришёл
if (substr($headers['Authorization'],0,5) == 'NTLM ') { // проверяем, что это NTLM-аутентификация
$chain = base64_decode(substr($headers['Authorization'],5)); // получаем декодированное значение
@Scrik
Scrik / http2_apache2_ubuntu16.04.md
Created February 7, 2023 16:17 — forked from GAS85/http2_apache2_ubuntu16.04.md
How to Enable HTTP/2 in Apache 2.4 on Ubuntu 16.04

Requirements

  • A self-managed VPS or dedicated server with Ubuntu 16.04 running Apache 2.4.xx.
  • For Ubuntu 18.04 please read here --> https://gist.github.com/GAS85/8dadbcb3c9a7ecbcb6705530c1252831
  • A registered domain name with working HTTPS (TLS/SSL). HTTP/2 only works alongside HTTPS because most browsers, including Firefox and Chrome, don’t support HTTP/2 in cleartext (non-TLS) mode.
@Scrik
Scrik / http2_apache2_ubuntu18.04.md
Created February 7, 2023 16:17 — forked from GAS85/http2_apache2_ubuntu18.04.md
How to Enable HTTP/2 in Apache 2.4 on Ubuntu 18.04

Requirements

  • A self-managed VPS or dedicated server with Ubuntu 18.04 running Apache 2.4.xx.
  • A registered domain name with working HTTPS (TLS/SSL). HTTP/2 only works alongside HTTPS because most browsers, including Firefox and Chrome, don’t support HTTP/2 in cleartext (non-TLS) mode.

Step 1: Install Apache2

@Scrik
Scrik / apache2_pihole.md
Created February 7, 2023 16:17 — forked from GAS85/apache2_pihole.md
Apache2 config for pihole with custom / non-admin link
@Scrik
Scrik / http2_apache2_ubuntu20.04.md
Created February 7, 2023 16:16 — forked from GAS85/http2_apache2_ubuntu20.04.md
How to Enable HTTP/2 in Apache 2.4 on Ubuntu 20.04

Based on https://gist.github.com/GAS85/8dadbcb3c9a7ecbcb6705530c1252831

Requirements

  • A self-managed VPS or dedicated server with Ubuntu 20.04 running Apache 2.4.xx.
  • A registered domain name with working HTTPS (TLS/SSL). HTTP/2 only works alongside HTTPS because most browsers, including Firefox and Chrome, don’t support HTTP/2 in cleartext (non-TLS) mode.

Step 1: Install Apache2

Per default it will be apache2 version 2.4.41 what is enought for http2 support.