Skip to content

Instantly share code, notes, and snippets.

@evandhoffman
evandhoffman / README.md
Last active December 28, 2023 11:24
Ubuntu Nginx Zoneminder php-fpm config

Zoneminder provides instructions for setting up Zoneminder on Ubuntu, but they assume you're using Apache: https://wiki.zoneminder.com/Ubuntu_Server_16.04_64-bit_with_Zoneminder_1.30.0_the_easy_way

I've moved away from Apache for webserving and wanted to see if there was a way to configure Zoneminder to work using Nginx and php-fpm. After a lot of trial and error I got it working. Include the snippet above in your nginx config to get it working at http:///zoneminder/ .

@evandhoffman
evandhoffman / fetch-phpbb.pl
Created March 13, 2012 18:23
Perl script to fetch all topics in a phpBB forum and save them to disk
#!/usr/bin/perl
use strict;
use warnings;
require LWP::UserAgent;
use POSIX qw/ceil/;
my $ua = LWP::UserAgent->new(agent => 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:10.0.2) Gecko/20100101 Firefox/10.0.2');
$ua->timeout(10);
@evandhoffman
evandhoffman / delete.js
Last active November 10, 2021 13:16
Delete your discord messages in a channel older than a specific date
// Lifted partially from https://gist.github.com/orion-v/95cb48fa73808cdc5c589fe415cc65f1
// and https://github.com/vegeta897/snow-stamp/blob/main/src/convert.js#L2
const DISCORD_EPOCH = 1420070400000
function dateToPostId(date) {
return (date - DISCORD_EPOCH) * 4194304
//return new Date(snowflake / 4194304 + epoch)
}
@evandhoffman
evandhoffman / reverseproxy.conf
Created February 15, 2012 21:29
nginx reverse proxy config
proxy_cache_path /var/lib/nginx/cache/staticfiles levels=1:2 keys_zone=staticfilecache:120m inactive=180m max_size=50m;
proxy_cache_path /var/lib/nginx/cache/php levels=2:2 keys_zone=php:10m inactive=180m max_size=50m;
proxy_temp_path /var/lib/nginx/proxy;
proxy_connect_timeout 30;
proxy_read_timeout 120;
proxy_send_timeout 120;
#IMPORTANT - this sets the basic cache key that's used in the static file cache.
proxy_cache_key "$scheme://$host$request_uri";
# http://wp-performance.com/2010/10/nginx-reverse-proxy-cache-wordpress-apache/
@evandhoffman
evandhoffman / simc khal.txt
Last active June 16, 2020 19:56
simc khal
# Khalshazar - Assassination - 2020-06-16 15:56 - US/Doomhammer
# SimC Addon 1.12.5
# Requires SimulationCraft 820-01 or newer
rogue="Khalshazar"
level=120
race=dark_iron_dwarf
region=us
server=doomhammer
role=attack
@evandhoffman
evandhoffman / parse-secure.pl
Created November 17, 2011 05:24
Parse /var/log/secure for hacking attempts and insert into a SQL DB
#!/usr/bin/perl
#########################################################################
# Parse /var/log/secure for attacks and log the attacks to a database.
# 11/16/2011
# evandhoffman@gmail.com
#########################################################################
use strict;
use warnings;
# Jimb - Havoc - 2020-04-16 13:01 - US/Doomhammer
# SimC Addon 1.12.5
# Requires SimulationCraft 820-01 or newer
demonhunter="Jimb"
level=120
race=night_elf
region=us
server=doomhammer
role=attack
# Cellen - Retribution - 2020-04-02 10:17 - US/Doomhammer
# SimC Addon 1.12.5
# Requires SimulationCraft 820-01 or newer
paladin="Cellen"
level=120
race=human
region=us
server=doomhammer
role=attack
@evandhoffman
evandhoffman / SimpleHTTPServerWithUpload.py
Created December 6, 2018 17:56 — forked from UniIsland/SimpleHTTPServerWithUpload.py
Simple Python Http Server with Upload
#!/usr/bin/env python
"""Simple HTTP Server With Upload.
This module builds on BaseHTTPServer by implementing the standard GET
and HEAD requests in a fairly straightforward manner.
"""
@evandhoffman
evandhoffman / smb.conf
Created February 9, 2017 04:27
smb.conf with ZFS volumes mapped to Previous Versions
[global]
# other stuff here...
shadow: snapdir = .zfs/snapshot
shadow: sort = desc
shadow: format = snap_%Y-%m-%d-%H%M
[public]
comment = Files for all
browseable = yes