Skip to content

Instantly share code, notes, and snippets.

View kronenpj's full-sized avatar

Paul Kronenwetter kronenpj

View GitHub Profile
@willjasen
willjasen / 10-wancarp
Last active July 12, 2024 15:43 — forked from spali/10-wancarp
Disable WAN interfaces when CARP is down
#!/usr/local/bin/php
<?php
/*
This script can be used with OPNsense when using CARP in certain circumstances where CARP is desired on the LAN side
but where CARP cannot run on the WAN side. This script runs each time an event by CARP is generated. In the event that
there are multiple LAN interfaces where CARP is enabled, this script will check that all interfaces where CARP is
enabled are in a particular state (MASTER/BACKUP) before enabling or disabling its WAN interfaces.
*/
@jprenken
jprenken / 10-wireguard
Created February 7, 2022 12:17
OPNsense: Start/stop WireGuard based on CARP state change (place in /usr/local/etc/rc.syshook.d/carp/)
#!/usr/local/bin/php
<?php
/*
* Copyright (C) 2004 Scott Ullrich <sullrich@gmail.com>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
@spali
spali / 10-wancarp
Last active July 25, 2024 07:36
Disable WAN Interface on CARP Backup
#!/usr/local/bin/php
<?php
require_once("config.inc");
require_once("interfaces.inc");
require_once("util.inc");
$subsystem = !empty($argv[1]) ? $argv[1] : '';
$type = !empty($argv[2]) ? $argv[2] : '';
@AnatomicJC
AnatomicJC / android-backup-apk-and-datas.md
Last active July 29, 2024 16:31
Backup android app, data included, no root needed, with adb

Backup android app, data included, no root needed, with adb

Note: This gist may be outdated, thanks to all contributors in comments.

adb is the Android CLI tool with which you can interact with your android device, from your PC

You must enable developer mode (tap 7 times on the build version in parameters) and install adb on your PC.

Don't hesitate to read comments, there is useful tips, thanks guys for this !

@muff1nman
muff1nman / chromecast-ssdp.xml
Created August 20, 2017 00:04 — forked from jgmel/chromecast-ssdp.xml
FirewallD Chromecast RHEL7/Centos7
<?xml version="1.0" encoding="utf-8"?>
<service>
<short>chromecast-ssdp</short>
<port protocol="udp" port="1900"/>
<destination ipv4="239.255.255.250/32"/>
</service>
@robinsmidsrod
robinsmidsrod / make_vbox.sh
Created May 16, 2016 11:47
Build script for custom iPXE ROM for VirtualBox
make_vbox() {
pushd "$HOME/src/forked/ipxe/src" >/dev/null &&
#make bin/intel--virtio-net--pcnet32.dsk EMBED=../nic-menu.ipxe &&
make CONFIG=vbox bin/intel--virtio-net--pcnet32.isarom && #EMBED=config/vbox/embedded.ipxe &&
#perl util/padimg.pl --verbose --blksize 4096 bin/intel--virtio-net--pcnet32.isarom &&
echo "Max size of VirtualBox ROM is 56KB, 57344 bytes" &&
ls -l bin/intel--virtio-net--pcnet32.isarom &&
prefix=$(date +%Y%m%d-%H%M%S) &&
mkdir -p /ipxe/$prefix &&
cp -v bin/intel--virtio-net--pcnet32.isarom /ipxe/$prefix/ &&
@gbaman
gbaman / HowToOTG.md
Last active July 19, 2024 11:47
Simple guide for setting up OTG modes on the Raspberry Pi Zero

Raspberry Pi Zero OTG Mode

Simple guide for setting up OTG modes on the Raspberry Pi Zero - By Andrew Mulholland (gbaman).

The Raspberry Pi Zero (and model A and A+) support USB On The Go, given the processor is connected directly to the USB port, unlike on the B, B+ or Pi 2 B, which goes via a USB hub.
Because of this, if setup to, the Pi can act as a USB slave instead, providing virtual serial (a terminal), virtual ethernet, virtual mass storage device (pendrive) or even other virtual devices like HID, MIDI, or act as a virtual webcam!
It is important to note that, although the model A and A+ can support being a USB slave, they are missing the ID pin (is tied to ground internally) so are unable to dynamically switch between USB master/slave mode. As such, they default to USB master mode. There is no easy way to change this right now.
It is also important to note, that a USB to UART serial adapter is not needed for any of these guides, as may be documented elsewhere across the int

@vasi
vasi / mount.backuppc
Created January 4, 2015 18:33
Allow adding backuppcfs.pl filesystems to fstab
#!/usr/bin/perl
use warnings;
use strict;
use Getopt::Long;
use Data::Dumper;
my $debug = 0;
# Valid options for backuppcfs
@jtyr
jtyr / VirtualBoxKickstart.md
Last active February 23, 2024 01:38
How to use kickstart in VirtualBox

How to use kickstart in VirtualBox

This short howto describes how to install VMs via kickstart in VirtualBox. It's using PXE functionality built into the NAT network mode of the VirtualBox. The following instructions apply to CentOS installation but it should work for any RedHat-based distro.

Prepare directory structure

@Zearin
Zearin / python_decorator_guide.md
Last active July 24, 2024 03:06
The best explanation of Python decorators I’ve ever seen. (An archived answer from StackOverflow.)

NOTE: This is a question I found on StackOverflow which I’ve archived here, because the answer is so effing phenomenal.


Q: How can I make a chain of function decorators in Python?


If you are not into long explanations, see [Paolo Bergantino’s answer][2].