Skip to content

Instantly share code, notes, and snippets.

View matthanley's full-sized avatar

Matt Hanley matthanley

View GitHub Profile
@jakebellacera
jakebellacera / ICS.php
Last active July 10, 2024 11:27
A convenient script to generate iCalendar (.ics) files on the fly in PHP.
<?php
/**
* This is free and unencumbered software released into the public domain.
*
* Anyone is free to copy, modify, publish, use, compile, sell, or
* distribute this software, either in source code form or as a compiled
* binary, for any purpose, commercial or non-commercial, and by any
* means.
*
@cbetta
cbetta / update.rb
Last active December 12, 2015 04:28
apt-get update before puppet
stage { 'preinstall':
before => Stage['main']
}
class apt_get_update {
exec { 'apt-get -y update': }
}
class { 'apt_get_update':
stage => preinstall
@pamelafox-coursera
pamelafox-coursera / CalendarHelper.class.php
Created April 10, 2013 23:09
Generate iCal files in PHP
<?php
class CalendarEvent {
/**
*
* The event ID
* @var string
*/
private $uid;
@aklinkert
aklinkert / log_all_socket_events.js
Last active January 14, 2019 19:42
Log all Sockets Events of an socket.io client
// pre 1.0
(function() {
var emit = socket.emit;
socket.emit = function() {
console.log('***','emit', Array.prototype.slice.call(arguments));
emit.apply(socket, arguments);
};
var $emit = socket.$emit;
socket.$emit = function() {
console.log('***','on',Array.prototype.slice.call(arguments));
@tomgidden
tomgidden / wsrep_notify_slack
Created February 25, 2015 21:32
Send wsrep / galera notifications for mysql clusters to a slack.com webhook
#!/usr/bin/env python
# configure this in my.cnf on a Galera-based MySQL-alike server:
# wsrep_notify_cmd=/usr/local/sbin/wsrep_notify_slack
# by Tom Gidden <gid@starberry.tv>
url = 'https://hooks.slack.com/services/XXXXXXX/XXXXXXXX/XXXXXXXX'
import argparse
@cupracer
cupracer / varnishlog-examples.sh
Last active May 12, 2024 17:50
varnishlog examples (version 4.x)
# filter by request host header
varnishlog -q 'ReqHeader ~ "Host: example.com"'
# filter by request url
varnishlog -q 'ReqURL ~ "^/some/path/"'
# filter by client ip (behind reverse proxy)
varnishlog -q 'ReqHeader ~ "X-Real-IP: .*123.123.123.123"'
# filter by request host header and show request url and referrer header
@teknoraver
teknoraver / unixhttpc.go
Last active July 8, 2024 10:12
HTTP over Unix domain sockets in golang
package main
import (
"context"
"flag"
"fmt"
"io"
"net"
"net/http"
"os"