Skip to content

Instantly share code, notes, and snippets.

@magicstone1412
magicstone1412 / wg-auto-reconnect.sh
Created September 15, 2024 23:03
Auto reconnect Wireguard on Debian
#!/bin/bash
# Function to check internet connection
check_internet() {
if ping -q -c 1 -W 1 8.8.8.8 >/dev/null 2>&1; then
return 0 # Internet is available
else
return 1 # No internet connection
fi
}
@magicstone1412
magicstone1412 / android_gateway.txt
Created September 8, 2024 10:24 — forked from gcleaves/android_gateway.txt
Wireguard peer as internet gateway, using Android USB tethering
# attempt 6, success
# relies on Magisk auto start script
# pause script to give wireguard time to autostart
bullhead:/ # cat /data/adb/service.d/prep_gateway.sh
#!/system/bin/sh
sleep 2m
su -c 'iptables -F tetherctrl_FORWARD'
su -c 'sysctl -w net.ipv4.ip_forward=1'
su -c 'iptables -A FORWARD -i tun0 -j ACCEPT'
su -c 'iptables -t nat -A POSTROUTING -o rmnet_data0 -j MASQUERADE'
{
"target": "terminus_exec",
"cancel": "terminus_cancel_build",
"focus": true,
"timeit": true,
"cmd": ["python3", "-u", "$file"],
"file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
"selector": "source.python",
  1. Install Notepad++ (check "set as default HTML editor" to replace Notepad in IE).

  2. Run Notepad++, update its plugins, and install "NppExec" via Plugins, Plugin Manager.

  3. Download DBGpPlugin . Place in C:\Program Files (x86)\Notepad++\plugins\DBGpPlugin

  4. Use this link to download a modified version of the Komodo Remote Debugging Package. Place in plugin directory. (Unmodified Komodo package does not work with DBGpPlugin) Also contains DBGpPlugin

  5. Enter these scripts for Python debugging:

    Press F6 to create a NppExec Execute script, save as "Run Python":

    cd "$(CURRENT_DIRECTORY)"
    
@magicstone1412
magicstone1412 / example_cloudflare4ddns
Created May 5, 2024 10:31
Example of cloudflare4ddns script
# Update Cloudflare DNS IPv4 address script
# RouterOS version >= 6.44 is required
# Update time 17:35:25 UTC Thursday, 22 February 2024 by hyk0083
# ** CONFIGURE SECTION **
# WAN IPv4 interface
:local wanif "pppoe-out1"
# Cloudflare section
@magicstone1412
magicstone1412 / prometheus.yml
Created April 26, 2024 02:54
1st prometheus configuration file
# Global
# # The first block, global, contains global settings for controlling the Prometheus
# # server’s behavior
global:
scrape_interval: 15s
evaluation_interval: 15s
# Alerting
# # The second block, alerting, configures Prometheus’ alerting.
# # Alerting is provided by a standalone tool called Alertmanager
@magicstone1412
magicstone1412 / format.hdd
Created October 4, 2021 10:12
Format new HDD drive using command line
# fdisk /dev/sda
Welcome to fdisk (util-linux 2.33.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Device does not contain a recognized partition table.
The size of this disk is 3.7 TiB (4000787030016 bytes). DOS partition table format cannot be used on drives for volumes larger than 2199023255040 bytes for 512-byte sectors. Use GUID partition table format (GPT).
Created a new DOS disklabel with disk identifier 0x5644fbf2.
name: Build & Deploy Hugo Static Site to Backblaze B2
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
deploy:
runs-on: ubuntu-latest
// from https://maltechx.de/en/2020/06/host-static-page-on-backblaze-with-cloudflare-workers/
// Backblaze Url
const baseURL = "https://f000.backblazeb2.com/file/skywirex"
addEventListener('fetch', event => {
event.respondWith(handleRequest(event))
})
async function handleRequest(event) {
{
"version": "v1.0.1",
"sk": "cae32fbbe5429d1b6e98965a1cf73e1534606f5b6b1eebdda49ef1a2e5a435f7",
"pk": "03f89b7d5749cffed7fca691478ac846076e45925c8bc0aad609ffad40e640ee6a",
"dmsg": {
"discovery": "http://dmsgd.skywire.skycoin.com",
"sessions_count": 1
},
"dmsgpty": {
"port": 22,