Skip to content

Instantly share code, notes, and snippets.

View voxxit's full-sized avatar

Josh Delsman voxxit

View GitHub Profile
@voxxit
voxxit / truthy.rb
Created February 4, 2016 19:05 — forked from mmcclimon/truthy.rb
Port Perl's truthy values to Ruby.
#!/usr/bin/env ruby
class Object
# The following are falsy: false, nil, 0, "", and empty arrays/hashes.
# Anything else falls is truthy. This emulates Perl's truthiness.
def truthy?
if self.nil?
return false
elsif self.is_a? Fixnum
return self != 0
@voxxit
voxxit / README.md
Created December 20, 2015 21:10
HOW-TO: Free up disk inodes

First, run the following as root to find out which folder is using the most disk inodes:

# for i in `ls -1A`; do echo "`find $i | sort -u | wc -l` $i"; done | sort -rn | head -5
94520 usr
40694 proc
39851 mnt
39845 srv
34830 home
@voxxit
voxxit / main.go
Created October 11, 2015 22:12
Code snippets for "Supercharge Your DevOps Arsenal: Building Your First CLI Tool in Go"
package main
import (
“os”
“github.com/codegangsta/cli”
)
var app *cli.App
@voxxit
voxxit / PROJECTS.md
Created October 2, 2015 11:38
Some open-source projects I've worked on

Keybase proof

I hereby claim:

  • I am voxxit on github.
  • I am jdelsman (https://keybase.io/jdelsman) on keybase.
  • I have a public key whose fingerprint is 108A 6856 B063 C346 5E18 E5E0 4D5B 0821 3624 A862

To claim this, I am signing this object:

@voxxit
voxxit / libsum.go
Last active September 15, 2015 17:32
Ruby is 966.06x stupider at maths on my MacBook Pro... http://c7.se/go-and-ruby-ffi
package main
import "C"
//export add
func add(a, b int) int {
return a + b
}
func main() {}
@voxxit
voxxit / nginx.conf
Created August 26, 2015 19:00
Working NGINX configuration; for use with HTTP/2 Dockerfile here: https://gist.github.com/voxxit/48217044067bb859248e
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
@voxxit
voxxit / Dockerfile
Last active April 6, 2022 01:52
nginx v1.9.3 Dockerfile with HTTP/2 support baked in!
FROM alpine:latest
MAINTAINER Joshua Delsman <j@srv.im>
EXPOSE 443
ENV NGINX_VERSION 1.9.3
RUN apk add --update openssl-dev pcre-dev zlib-dev build-base \
&& rm -rf /var/cache/apk/* \
@voxxit
voxxit / download-slow-query-log.sh
Last active October 31, 2023 16:13
Downloads RDS slow query logs for the last 24 hours using the AWS CLI
#!/bin/bash
instanceID=$1
date=$(date +%Y%m%d)
function downloadLog () {
local log=$1
aws rds download-db-log-file-portion \
--output text \
@voxxit
voxxit / main.go
Last active August 29, 2015 14:27
Listens for webhooks from PagerDuty, and lights up all lights on the first Hue bridge found on the local network
package main
import (
"log"
"os"
"strconv"
"github.com/codegangsta/cli"
"github.com/gin-gonic/gin"
"github.com/mediocregopher/radix.v2/redis"