Skip to content

Instantly share code, notes, and snippets.

@cntlscrut
cntlscrut / whatever.py
Created November 9, 2012 23:06
Python email script for gmail
#!/usr/bin/python
import smtplib
from email.MIMEMultipart import MIMEMultipart
from email.MIMEBase import MIMEBase
from email.MIMEText import MIMEText
from email import Encoders
import os
gmail_user = "YOUREMAIL@WHATEVER.COM"
@cntlscrut
cntlscrut / aclcreate.php
Created June 15, 2018 20:20
Quick CSV to ACL declaration function
<?php
/**
* Read in a CSV file as taken from the command line arg
* CSV file needs to be in the same directory as this
* script for the time being
*
* Output is expected to be text representing an ACL
* declaration that can be copypasta'd into a VCL file.
*
RewriteCond %{THE_REQUEST} \?
RewriteCond %{REQUEST_URI} !^/news
RewriteCond %{QUERY_STRING} !itok=([0-9]+)
RewriteRule ^ %{REQUEST_URI} [L,R.QSD]
@cntlscrut
cntlscrut / gist:fe65da6714f5828e9509ea1617cbde90
Created July 20, 2020 15:03
settings file connection for ln 777
line 777 changed to the below:
require('/var/www/site-php/beagov/beagov-settings.inc');
altogether should look like:
if (file_exists('/var/www/site-php')) {
global $conf, $databases;
$conf['acquia_hosting_settings_autoconnect'] = FALSE;
// EDIT next line to proper path to include file.
require('/var/www/site-php/beagov/beagov-settings.inc');
# Drop URL parameters for paths do not need them
RewriteCond %{REQUEST_URI} \.(pdf|xlsx|xls) [OR]
RewriteCond %{THE_REQUEST} data?|2020?
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^?]*)\?
RewriteCond %{QUERY_STRING} !itok=([0-9]+)
RewriteRule (.*) /$1? [R=301,L]