Skip to content

Instantly share code, notes, and snippets.

@johnstanfield
johnstanfield / gmail-diet-greasemonkey.js
Created October 15, 2018 13:29
GMail diet - Greasemonkey / Tampermonkey script that makes the new GMail a bit more like the old GMail
// ==UserScript==
// @name GMail Diet
// @namespace http://johnstanfield.com/
// @version 0.1
// @description deflates the ~3Q2018 GMail web app. The GMail web app prior to the version released around Q3 2018 was nice and compact. The new version has extra padding that is trimmed by this script. Tested in Tampermonkey on Chrome 56.
// @author John Stanfield
// @match *://mail.google.com/*
// @grant none
// ==/UserScript==
<VirtualHost *:80>
# suppose you have a SocketIO server running on port 8001
# the first request uses the HTTP protocol, and its response instructs the client to use WebSockets
# subsequent requests are supposed to use the WebSocket protocol
# this is one way to have an Apache proxy the requests to SocketIO
#
# not sure if this is suitable for production use
# my production environment uses AWS Elastic Load Balancers, not Apache
# my dev and pen-test environments do use Apache, and this is how I make them work
#!/bin/bash
#
# backs up gitolite to s3
# SSH's into the gitolite host to list all repositories
# then clones each repo
# - on subsequent runs, it updates the repo rather than reclone (this is faster)
# - todo: test what happens after a force push; perhaps rm -rf and reclone
# then does a git bundle to turn the repo into a single-file backup
# - todo: handle empty repos (or delete empty repos from gitolite)
# then pushes the file to an S3 bucket
@johnstanfield
johnstanfield / agent.conf
Last active August 1, 2023 03:33
Configuration to make OSSEC HIDS watch fail2ban.log and alert on fail2ban actions
<!-- add this to /var/ossec/etc/shared/agent.conf -->
<localfile>
<log_format>syslog</log_format>
<location>/var/log/fail2ban.log</location>
</localfile>
@johnstanfield
johnstanfield / mail.rb
Created December 21, 2016 03:22
Example showing how to create a Mail::Message and extract bcc addresses, html, and plain body
# build an email
mail = Mail.new do
to 'to@example.com'
from 'from@example.com'
bcc ['asdf@example.com','foo@example.com','bar@example.com']
subject 'test email'
end
text_part = Mail::Part.new do
body 'This is plain text'