This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Function to recursively process Apache config files | |
process_config_file() { | |
local file="$1" | |
local server_root="$2" | |
local indent="${3:-}" | |
# Check if file exists | |
if [[ ! -f "$file" ]]; then |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# install systemd-timesyncd | |
apt-get install systemd-timesyncd | |
# configure NTP server, or keep defaults | |
nano /etc/systemd/timesyncd.conf | |
# restart daemon | |
systemctl restart systemd-timesyncd | |
# check service status | |
systemctl status systemd-timesyncd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function encodeMPINT($binary) | |
{ | |
// If the most significant bit is set, prepend a zero byte to make it positive | |
if (ord($binary[0]) & 0x80) { | |
$binary = "\x00".$binary; | |
} | |
// Encode the length as a 32-bit big-endian integer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# Get loglines from /var/log/auth.log containing accepted SSH key hashes. | |
# Then match that hash with the keys in the users' authorized_keys file. | |
# | |
# Caveats: | |
# - Expects specific format of auth.log, only tested on Debian | |
# - Expects authorized_keys to be in .ssh/authorized_keys in user homefolder | |
# - Uses eval to get home folder (potentially insecure) | |
# | |
while read -r D1 D2 D3 U K; do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
If you find yourself locked in a situation where you can't do anything on a table (not even select) when getting | |
```ERROR 1709 (HY000): Index column size too large. The maximum column size is 767 bytes.``` | |
then this on is for you. | |
Cause: Your key field is utf8mb4, which uses 4 bytes per character, and row_format isn't set to Dymanic. | |
Problem: you can't do anything with the table data (SELECT, UPDATE, DELETE,ALTER,DROP,... | |
Solution: | |
- stop mysqld and start mysqld in debug mode through (/usr/bin/mysqld-debug) | |
- connect to mysql, and set debugging options: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# This will create and setup a MySQL group replication cluster with a given number of members. | |
# Set the number of members below, and then execute this file. You probably want at least 3 members. | |
# | |
# This will create volumes and containers named mysql-X, where X is the number of the member. | |
# If you currently have volumes with the same name, these might be destroyed! | |
# | |
MEMBERS=3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# use case: Reverse proxy for system that returns fully-qualified URLS in the content (eg. wsdl file) | |
# | |
# Requires: mod_proxy, mod_proxy_http and mod_substitute | |
# | |
ProxyPass / http://backend-server/Some/API/On/Some/Path/ | |
ProxyPassReverse / http://backend-server/Some/API/On/Some/Path/ | |
# Rewrite URLs in wsdl |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Apache Rewrite all requests to lowercase URLs | |
RewriteEngine On | |
RewriteMap lc int:tolower | |
RewriteCond %{REQUEST_URI} [A-Z] | |
RewriteRule (.*) ${lc:$1} [R=301,L] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Foreach ($Site in get-website) { | |
Foreach ($Bind in $Site.bindings.collection) { | |
Write-Host $Site.name ":" $Site.state ":" $Bind.Protocol ":" $Bind.BindingInformation | |
} | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# Check a websocket connection with curl. Pass URL to check as parameter. | |
# In normal conditions, this should return a 101 (Switching protocol). | |
# | |
CODE=$(timeout 3 curl -s --http1.1 \ | |
--include \ | |
--no-buffer \ | |
--header "Connection: Upgrade" \ |
NewerOlder