This file contains hidden or 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 | |
# Script to add nginx-404 fail2ban configuration | |
FILTER_FILE="/etc/fail2ban/filter.d/nginx-404.conf" | |
JAIL_FILE="/etc/fail2ban/jail.d/nginx-404.local" | |
JAIL_LOCAL="/etc/fail2ban/jail.local" | |
JAIL_NAME="nginx-404" | |
# 1. Add filter file: nginx-404.conf |
This file contains hidden or 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
services.AddAuthentication() | |
.AddOpenIdConnect("Line", "Line", options => | |
{ | |
options.CallbackPath = "/signin-line"; | |
options.Scope.Add("openid"); | |
options.Scope.Add("profile"); | |
options.Scope.Add("email"); | |
options.RequireHttpsMetadata = true; | |
options.SaveTokens = true; | |
options.GetClaimsFromUserInfoEndpoint = true; |
This file contains hidden or 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
using System.Reflection; | |
using VaultApi.Domain.Constants; | |
using VaultApi.Domain.Entities; | |
using Microsoft.AspNetCore.Builder; | |
using Microsoft.AspNetCore.Identity; | |
using Microsoft.EntityFrameworkCore; | |
using Microsoft.Extensions.DependencyInjection; | |
using Npgsql; | |
using VaultApi.Domain.Common; |
This file contains hidden or 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
server { | |
server_name nextcloud.mydomain.com; | |
client_max_body_size 2G; | |
location / { | |
proxy_pass http://localhost:5001; | |
proxy_set_header Host $http_host; | |
proxy_set_header X-Real-IP $remote_addr; | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
proxy_set_header X-Forwarded-Proto https; | |
proxy_cache_bypass $http_upgrade; |
This file contains hidden or 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
version: '3' | |
services: | |
db: | |
image: mariadb:10.6 | |
restart: always | |
command: --transaction-isolation=READ-COMMITTED --binlog-format=ROW | |
volumes: | |
- ./database:/var/lib/mysql | |
environment: |
This file contains hidden or 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 | |
declare -A custom_names | |
custom_names["8427e3af:14f642d8:316fd036:e279d458"]="/root" | |
custom_names["f2e76944:da560738:512c4030:54026dcf"]="/opt" | |
for drive in /dev/sd[a-e]; do | |
if smartctl -A "$drive" | grep -q 'Host_Writes_GiB'; then | |
md_name=$(mdadm --examine "$drive" | grep "Array UUID" | awk '{print $4}') | |
if [ -n "$md_name" ]; then |
This file contains hidden or 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
## Add to crontab | |
# */5 * * * * /root/autoUpdate.sh | ts | tee -a /var/log/updater/updater-$(date +'\%Y-\%m-\%d').log | |
#!/bin/bash | |
# Define a function for null coalescing | |
coalesce() { | |
if [ -n "$1" ]; then | |
echo "$1" | |
else | |
echo "$2" |
This file contains hidden or 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 script installs a systemd timer template named WireguardReResolveDNS.(service|timer) | |
# to run every 30 seconds. Requires that wireguard-tools is installed. | |
# Enable using e.g. systemctl enable --now [email protected] | |
# You need to do that separately for each wireguard interface | |
export NAME=wg-reresolve-dns@ | |
cat >/etc/systemd/system/${NAME}.service <<EOF | |
[Unit] |
This file contains hidden or 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 oh-my-posh using brew | |
# eval "$(oh-my-posh init zsh --config ~/shell.json)" | |
# eval "$(oh-my-posh completion zsh)" | |
{ | |
"$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json", | |
"final_space": true, | |
"blocks": [ | |
{ | |
"type": "prompt", |
This file contains hidden or 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/sh | |
# | |
# Retrieve the argument and create a name for a tmp file | |
# | |
processfile=$1 | |
tmpfile=${1}.tmp | |
# | |
# for all running docker containers |
NewerOlder