Skip to content

Instantly share code, notes, and snippets.

@Nilpo
Nilpo / mail_relay.py
Created February 2, 2024 04:16 — forked from ashafer01/mail_relay.py
Drop-in replacement for sendmail -t which relays to gmail smtp, should be easy to adapt to any smtp
#!/usr/bin/env python3
import email
import smtplib
import sys
smtp_address = "smtp.gmail.com"
smtp_port = 587
smtp_user_name = "YOUR_EMAIL@gmail.com"
smtp_password = "YOUR_APP_PASSWORD"
@Nilpo
Nilpo / autoconfig.php
Last active January 8, 2024 06:14
Autoconfig config-v1.1.xml generator in PHP for Thunderbird mail client.
<?php
//get query data so we can extract the email address
$email = $_REQUEST['emailaddress'];
$domain = explode('@', $_REQUEST['emailaddress'])[1];
//set Content-Type
header("Content-Type: application/xml");
echo '<?xml version="1.0" encoding="utf-8" ?>'; ?>
<clientConfig version="1.1">
@Nilpo
Nilpo / autodiscover.php
Last active January 8, 2024 06:16
Autodiscover.xml generator in PHP for Outlook (and other) mail client configuration.
<?php
//get raw POST data so we can extract the email address
$data = file_get_contents("php://input");
preg_match("/\<EMailAddress\>(.*?)\<\/EMailAddress\>/", $data, $matches);
//set Content-Type
header("Content-Type: application/xml");
echo '<?xml version="1.0" encoding="utf-8" ?>'; ?>
<Autodiscover xmlns="http://schemas.microsoft.com/exchange/autodiscover/responseschema/2006">
@Nilpo
Nilpo / MaidenHeadLocater.php
Last active April 6, 2023 09:44
Calculate Maidenhead Grid Square Locator from Latitude/Longitude coordinate pairs.
<?php
/**
* Calculates a Maidenhead Grid Square Locator containing
* the given latitude/longitude (WGS84) coordinate pair.
*
* @param string|float $input_lat
* @param string|float $input_lng
* @return string
*/
@Nilpo
Nilpo / Ketarin_ParseVersionFromUrl.md
Created February 28, 2023 11:20 — forked from sheldonhull/Ketarin_ParseVersionFromUrl.md
Using Regex in Ketarin to parse textual content from url
@Nilpo
Nilpo / .env
Last active December 7, 2022 18:27 — forked from gilbitron/CaddyController.php
Enabling HTTPS (SSL) for Laravel Sail using Caddy
APP_URL=https://laravel.test
APP_SERVICE=laravel.test
[...]
@Nilpo
Nilpo / git-aware-bash-prompt.md
Created April 5, 2022 02:00 — forked from eliotsykes/git-aware-bash-prompt.md
Git Aware Bash Prompt
@Nilpo
Nilpo / How to passthrough SATA drives directly on VMWare ESXi 6.5 as RDMs.md
Last active July 13, 2020 00:16 — forked from Hengjie/tutorial.md
How to passthrough SATA drives directly on VMWare ESXi 6.5 as RDMs

How to passthrough SATA drives directly on VMWare ESXi 6.5 as RDMs

There aren't many tutorials about this, the only tutorials I've found were about passing through entire PCIe cards to VMs, or refered to old ESXi versions (below 6.5) that used a more comprehensive desktop client instead of the web app. In v6.5, the web app was introduced and the desktop client was deprecated. You used to be able to setup RDMs in the desktop client, but with the introduction of the web console, this is no longer the case. This tutorial shows you how to pass SATA HDDs to the virtual machine on VMWare ESXi 6.5. This tutorial is partially based on VMWare's own KB and the now deprecated Forza IT blog post.

A word about VMWare ESXi 6.7

There is now an option while editing your VM's settings to add a New raw disk when you click `Add ha

@Nilpo
Nilpo / download.py
Created October 26, 2019 03:44 — forked from triple-j/download.py
Download file through HTTP using requests.py and tqdm
import os.path
from urllib.request import urlopen
import requests
from tqdm import tqdm
def download_from_url(url, dst):
"""
@param: url to download file
@param: dst place to put the file
@Nilpo
Nilpo / animated-favicons.js
Created October 11, 2019 03:25
Animating Favicons with jQuery
var favicon_images = [
'http://website.com/img/tmp-0.gif',
'http://website.com/img/tmp-1.gif',
'http://website.com/img/tmp-2.gif',
'http://website.com/img/tmp-3.gif',
'http://website.com/img/tmp-4.gif',
'http://website.com/img/tmp-5.gif',
'http://website.com/img/tmp-6.gif'
],
image_counter = 0; // To keep track of the current image