Skip to content

Instantly share code, notes, and snippets.

@Nilpo
Nilpo / Using Git to Manage a Live Web Site.md
Last active April 3, 2024 06:29
Using Git to Manage a Live Web Site

Using Git to Manage a Live Web Site

Overview

As a freelancer, I build a lot of web sites. That's a lot of code changes to track. Thankfully, a Git-enabled workflow with proper branching makes short work of project tracking. I can easily see development features in branches as well as a snapshot of the sites' production code. A nice addition to that workflow is that ability to use Git to push updates to any of the various sites I work on while committing changes.

Contents

@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 / BIND for the Small LAN.md
Last active January 17, 2024 16:34
How to configure BIND 9 to act as a caching nameserver or as the nameserver for a local domain.
@Nilpo
Nilpo / lazyload_google_analytics.html
Created December 26, 2013 04:47
Lazy load Google Analytics
<script type="text/javascript">
(function($) {
$("body").load(function() {
setTimeout(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
}, 1);
});
})(jQuery);
@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 / 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 / allow
Created September 16, 2016 01:40 — forked from Mteigers/allow
CSF Allow AND Ignore Cloudflare IPv4 IP's.
for i in `curl https://www.cloudflare.com/ips-v4`; do csf -a $i; done
@Nilpo
Nilpo / Autoloader.php
Last active August 25, 2023 18:41
A simple recursive PHP autoloader using the RecursiveDirectoryIterator.
<?php
/*
* The MIT License (MIT)
*
* Copyright (c) 2014 Rob Dunham
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
@Nilpo
Nilpo / Session.php
Last active August 5, 2023 16:48
A simple session wrapper class to provide static OOP access to PHP sessions.
<?php
/**
* Session Helper Class
*
* A simple session wrapper class.
*
* Recommended for use with PHP 5.4.0 or higher. (Not required.)
*
* Usage Example: