Skip to content

Instantly share code, notes, and snippets.

View olex0r's full-sized avatar
🏠
Working from home again )

Olexor S olex0r

🏠
Working from home again )
View GitHub Profile
@olex0r
olex0r / functions.php
Created July 16, 2023 08:32
Fix permalink of categories matching primary category in aio seo plugin (All in One SEO Pack)
<?php
/*
* Author: https://github.com/olex0r
*
* Fix permalink of categories matching primary category in aio seo plugin (All in One SEO Pack)
* This code snippet is a WordPress filter that modifies the permalink (URL) of product categories
* in the WooCommerce plugin when the "All in One SEO Pack" (AIO SEO) plugin is active. It ensures
* that the permalink for a category matches the primary category set by the AIO SEO plugin
* for a specific product.
*
@olex0r
olex0r / wanip.sh
Created April 14, 2022 05:30
Get WAN IP
#!/bin/bash
WANIP=$(dig TXT +short o-o.myaddr.l.google.com @ns1.google.com | awk -F'"' '{ print $2}')
WANGEO=$(geoiplookup $WANIP | cut -d ' ' -f 4,5)
echo $WANIP
echo $WANGEO
@olex0r
olex0r / install-prometheus.sh
Created April 13, 2022 04:43
Draft: Prometheus + Grafana
#!/bin/sh
cd ~
wget https://github.com/prometheus/prometheus/releases/download/v2.34.0/prometheus-2.34.0.linux-amd64.tar.gz
tar -xvf prometheus-2.34.0.linux-amd64.tar.gz
cd prometheus-2.34.0.linux-amd64
sudo mkdir -p /etc/prometheus
sudo mkdir -p /var/lib/prometheus
sudo mv prometheus promtool /usr/local/bin/
@olex0r
olex0r / mikrotik-wireguard-default-gw.sh
Last active August 22, 2024 10:17
Mikrotik wireguard client as default gateway
# You should change "XX.XX.XX.XX" to you wireguard server
# and set public-key,private-key,preshared-key,"YY.YY.YY.YY/YY" according to your config
/interface/wireguard/add name=wg0 private-key="[PRIVATE_KEY_HERE]"
/interface/wireguard/peers/add interface=wg0 endpoint-address=XX.XX.XX.XX endpoint-port=12321 public-key="[PUBLIC_KEY_HERE]" preshared-key="[PRESHARED_KEY_HERE]" persistent-keepalive=25s allowed-address=0.0.0.0/0
/ip/address/add interface=wg0 address=YY.YY.YY.YY/YY
/ip/route/add dst-address=XX.XX.XX.XX comment=wgserver disabled=yes