Skip to content

Instantly share code, notes, and snippets.

@notyal
notyal / remove-vw-pdf-popups.py
Last active January 26, 2023 02:07
Remove annoying popup messages on VW PDFs downloaded from erWin
#!/usr/bin/env python
def remove_popups(filename) -> None:
with open(filename, 'rb') as fb:
s = fb.read()
fb.close()
s = s.replace(b'showUSAPopup=true', b'showUSAPopup=0;;;')
s = s.replace(b'showPopup=true', b'showPopup=0;;;')
s = s.replace(b'showUSAPopup', b'nonoUSAPopup')
with open(filename, 'wb') as fb:
@notyal
notyal / ftbr-start.sh
Last active November 25, 2020 19:07
Script to run a Minecraft server in a screen session
#!/bin/bash
cd /opt/ftbr-minecraft
sudo -u minecraft _0="$0" /bin/bash ./serverstarter.sh $*
@notyal
notyal / set-packages-openwrt.sh
Created May 7, 2020 02:47
add additional packages from a list to openwrt .config
#!/bin/bash
# add additional packages from a list to openwrt .config
# its a good idea to run `make defconfig` afterwards
file="$1"
config="$2"
_testexist(){
# _testexist [file path] [type of file]
path="$1"
@notyal
notyal / uuid2name.sh
Created April 3, 2020 05:45
get names from uuid files in minecraft/world/playerdata/*
#!/bin/bash
# get names from uuid files in minecraft/world/playerdata/*
show_usage() {
echo "usage: $0 [file..]"
echo
echo "Where \`file' is one or more uuid.dat file located in minecraft/world/playerdata/"
echo "Example: $0 minecraft/world/playerdata/*"
}
@notyal
notyal / lnav-nginx-netdata.json
Last active December 20, 2023 14:44
lnav log format definition for NGINX access.log (netdata vhost format) and NGINX error.log
{
"nginx_access_log" : {
"title" : "NGINX NetData Access Log",
"description" : "NGINX NetData Access Log Format",
"url" : "https://github.com/netdata/netdata/blob/master/collectors/python.d.plugin/web_log/web_log.conf",
"multiline" : false,
"regex" : {
"netdata_vhost" : {
"pattern" : "(?P<host>[a-zA-Z\\d.-_\\[\\]]+)\\s+(?P<server_port>\\d+)\\s+(?P<remote_addr>[\\da-f.:]+)\\s+[\\w\\.\\-]+\\s+(?<remote_user>\\S+)\\s+\\[(?<timestamp>[^\\]]+)\\]\\s+\"(?:\\-|(?<request>\\w+) (?<request_uri>[^ \\?]+)(?:\\?(?<request_uri_query>[^ ]*))? (?<request_version>[\\w\\\/\\.]+))\"\\s+(?P<status>[1-9]\\d{2})\\s+(?P<body_bytes_sent>\\d+)\\s+(?P<request_length>\\d+)\\s+(?P<request_time>\\d+(?:.\\d+)?)\\s+(?:\\-|(?P<upstream_response_time>\\d+(?:.\\d+)?))\\s+\"(?<http_referer>[^\"]+)\"\\s+\"(?<http_user_agent>[^\"]+)\""
}
@notyal
notyal / wg0-makepeer.sh
Last active August 6, 2020 03:21
Script to create peers for WireGuard
#!/bin/bash
# script location: /etc/wireguard/peers
# prereq: wg0 server config in /etc/wireguard/wg0.conf
# prereq: wg0 publickey in /etc/wireguard/publickey
# prereq: `systemctl enable wg-quick@wg0.service`
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
# !! MAKE SURE to replace [CHANGEME] with your public IP !!
# !! (see endpoint variable under PEER CONFIG) !!
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
@notyal
notyal / unbound.conf
Last active July 30, 2019 01:31
unbound.conf for WireGuard usage
# https://calomel.org/unbound_dns.html
# https://nlnetlabs.nl/documentation/unbound/unbound.conf/
# https://www.ckn.io/blog/2017/11/14/wireguard-vpn-typical-setup/
server:
#hide-identity: yes
access-control: 0.0.0.0/0 deny
access-control: 127.0.0.1 allow
access-control: 172.17.17.0/24 allow
auto-trust-anchor-file: "/var/lib/unbound/root.key"
cache-max-ttl: 14400
##########
# Win 10 / Server 2016 / Server 2019 Initial Setup Script - Default preset
# Author: Disassembler <disassembler@dasm.cz>
# Version: v3.5, 2018-12-23
# Source: https://github.com/Disassembler0/Win10-Initial-Setup-Script
##########
### Require administrator privileges ###
RequireAdmin
version: '3'
services:
lasso:
container_name: lasso
image: bfoote/lasso
restart: always
ports:
- "9090:9090"
network_mode: bridge
# lasso config
lasso:
#logLevel: debug
logLevel: info
listen: 0.0.0.0
port: 9090
allowAllUsers: false
publicAccess: false
domains: