Skip to content

Instantly share code, notes, and snippets.

@Mwni
Mwni / vpnwiz.sh
Last active September 8, 2024 16:19
Bash script for creating OpenVPN servers along with multiple client configurations. Certificates and keys are inlined without passwords.
if ! [ -x "$(command -v openvpn)" ]; then
echo "openvpn is not installed on this machine"
echo "cannot continue"
exit
fi
read -p "project name (lowercase): " -r project
make_client() {
./easyrsa build-client-full $1 nopass &>/dev/null
@Mwni
Mwni / loadtimes.php
Created June 19, 2023 21:04
Simple PHP script for logging page load times. Will create a text file named "loadtimes.txt" in the working directory. Only use this for testing.
<?php
$starttime = microtime(true);
// PAGE CODE GOES HERE
try{
$endtime = microtime(true);
@Mwni
Mwni / nativescript-textfield-deletetap-patch.js
Last active April 7, 2023 12:35
Import/require this script into your nativescript app.ts to add a 'deleteTap' event to all your TextField components. This will fire a 'deleteTap' event when the user presses backspace, even when the text field is empty.
import { isAndroid, isIOS } from '@nativescript/core/platform'
import { layout } from '@nativescript/core/utils'
import { TextField } from '@nativescript/core/ui/text-field'
if(isIOS){
let UITextFieldImpl = (function (_super) {
__extends(UITextFieldImpl, _super)
function UITextFieldImpl() {
return _super !== null && _super.apply(this, arguments) || this
@Mwni
Mwni / mapkit-mousewheel-polyfill.js
Last active November 7, 2024 15:13
This snippet provides a polyfill for MapKit JS for zooming using mousewheel on Chrome, Firefox & IE.
/*
This snippet provides a polyfill for zooming using mousewheel on Chrome, Firefox & IE.
It adds the method 'enableCompatibilityZoom' on the mapkit.Map prototype.
usage:
map.enableCompatibilityZoom(smooth, delta)