Skip to content

Instantly share code, notes, and snippets.

@davidgiesberg
davidgiesberg / slack_delete.rb
Created November 15, 2016 15:26 — forked from jamescmartinez/slack_delete.rb
This Ruby script will bulk remove all Slack files older than 30 days. Just add your API token from https://api.slack.com/web#authentication into the token quotes at the top of the file.
require 'net/http'
require 'json'
require 'uri'
@token = ''
def list_files
ts_to = (Time.now - 30 * 24 * 60 * 60).to_i # 30 days ago
params = {
token: @token,
@davidgiesberg
davidgiesberg / random_directory_hierarchy.sh
Created August 1, 2016 14:58
Generate a random directory hierarchy
#!/usr/bin/env bash
# Good source of text to feed in:
# curl -s -X POST lipsum.com/feed/json -d "amount=100" -d "what=words" -d"start=true" | jq -r '.feed.lipsum'
root_dir="$1"
if [ -z "$root_dir" ]; then
echo "Usage: $(basename ${BASH_SOURCE}) <root directory>"
exit 1
fi
@davidgiesberg
davidgiesberg / README.md
Created September 30, 2014 02:30
Shellshock Chef Updates for Ubuntu

We added these bits to one of our base cookbooks that gets applied to every node.

Because apt doesn't allow you to specify a minimum version for a package to be installed, I had to build an approximation of that logic in this recipe. Basically, what we do is check for a bash package version that is less than what is specified in the node attributes for that platform. If and only if the installed version is less than the min_pkg_ver attribute, we notify apt_package[bash] to run the :upgrade action. That ought to prevent us from updating bash unnecessarily, but also ensuring that we are never running an unpatched bash.

(Also, handy thing to note is the execute[apt-get update] - that's using the apt cookbook to force an apt-get update to run immediately. If you don't do that, bash won't update until apt has updated AND this chef recipe runs again.

@davidgiesberg
davidgiesberg / statsd.sh
Created September 21, 2012 20:16 — forked from erickr/statsd.init.sh
Modified statsd.init.sh file to work on Debian
#!/bin/bash
#
# StatsD
#
# chkconfig: 3 50 50
# description: StatsD init.d
. /lib/lsb/init-functions
prog=statsd
STATSDDIR=/opt/statsd
@davidgiesberg
davidgiesberg / class.phpmailer.CloudSMTP.php
Created March 19, 2012 21:34
phplist CloudSMTP configuration
/** PHPMailer 5.2.1 for phplist 2.10.17 */
/** SNIPPED FROM class.phpmailer.php STARTING AT LINE 198 */
public $Host = 'relay.cloudsmtp.com';
/**
* Sets the default SMTP server port.
* @var int
*/
public $Port = 587;
@davidgiesberg
davidgiesberg / pdkim_mac_PPC_patch.diff
Created February 10, 2012 21:42
PDKIM Mac PPC patch
diff --git Makefile.mac Makefile.mac
index 5cb6f49..0acd485 100755
--- Makefile.mac
+++ Makefile.mac
@@ -3,7 +3,7 @@ VERSION_MAJOR=1
VERSION_MINOR=0
LIBNAME=libpdkim
-CFLAGS=-Wall -D_FILE_OFFSET_BITS=64 -fPIC -arch ppc -arch i386 -arch x86_64
+CFLAGS=-Wall -D_FILE_OFFSET_BITS=64 -fPIC -arch i386 -arch x86_64