Skip to content

Instantly share code, notes, and snippets.

View whatupdave's full-sized avatar

Dave Newman whatupdave

  • Twitter
  • Seattle, WA
View GitHub Profile
@whatupdave
whatupdave / index.html
Created December 17, 2010 01:37
Builds and packages an iOS app into dropbox for deployment
<!DOCTYPE html>
<html lang='en-US' xml:lang='en-US' xmlns='http://www.w3.org/1999/xhtml'>
<head>
<meta content='text/html; charset=utf-8' http-equiv='Content-type' />
<title>iBots Beta</title>
<style type='text/css'>
body {
font-family: 'Helvetica Neue Light', HelveticaNeue-Light, Helvetica, Arial, sans-serif;
width: 600px;
margin: 0 auto;
@whatupdave
whatupdave / factorio-Dockerfile
Created November 30, 2017 18:15
Some game dockerfiles
FROM frolvlad/alpine-glibc
MAINTAINER Dave Newman dave@partycloud.com
RUN apk --update add bash curl xz
RUN addgroup -S -g 1000 game && \
adduser -H -S -u 1000 game && \
mkdir /data && \
chown game:game /data
$ docker inspect k8s_prometheus-to-sd-exporter_fluentd-gcp-v2.0-d70xs_kube-system_8255735e-6e63-11e7-afdf-42010a800041_0
[
{
"Id": "46252c21f91c33521ed747828f4db244155a7cf018ca43116c3bfcc7302dad60",
"Created": "2017-07-21T22:25:39.01398793Z",
"Path": "/monitor",
"Args": [
"--component=fluentd",
"--stackdriver-prefix=container.googleapis.com/internal/addons",
"--whitelisted-metrics=logging_line_count,logging_entry_count"
$ docker inspect k8s_prometheus-to-sd-exporter_fluentd-gcp-v2.0-d70xs_kube-system_8255735e-6e63-11e7-afdf-42010a800041_0
[
{
"Id": "46252c21f91c33521ed747828f4db244155a7cf018ca43116c3bfcc7302dad60",
"Created": "2017-07-21T22:25:39.01398793Z",
"Path": "/monitor",
"Args": [
"--component=fluentd",
"--stackdriver-prefix=container.googleapis.com/internal/addons",
"--whitelisted-metrics=logging_line_count,logging_entry_count"
@whatupdave
whatupdave / kill-all.rb
Last active December 27, 2015 06:59
Delete all your s3 buckets with lifecycle rules. USE WITH CAUTION HOLY SHIT
#!/usr/bin/env ruby
require 'rubygems'
require 'fog'
# create a connection
connection = Fog::Storage.new({
:provider => 'AWS',
:aws_access_key_id => ENV['AWS_ACCESS_KEY'],
:aws_secret_access_key => ENV['AWS_SECRET_KEY']
@whatupdave
whatupdave / issues.rb
Created August 29, 2013 23:55
Download github issues to json
require 'octokit'
require 'json'
# AUTH=user:pwd ruby issues.rb rails/rails
login, pwd = (ENV['AUTH'] || ':').split(':')
repo = ARGV.shift
client = Octokit::Client.new(:login => login, :password => pwd)
@whatupdave
whatupdave / uke
Created July 18, 2013 20:12
Lisztomania Uke Part
---------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------
-4-4-4-4-4-4-4-4-4-4-4-4-4-4-4-4-6-6-6-6-6-6-6-6-7-7-7-7-7-7-7-7-9--9--9--9--9--9--9--9--6-6-6-6-6-6-6-6-
-2-2-2-2-2-2-2-2-4-4-4-4-4-4-4-4-6-6-6-6-6-6-6-6-7-7-7-7-7-7-7-7-11-11-11-11-11-11-11-11-6-6-6-6-6-6-6-6-
@whatupdave
whatupdave / month.rb
Created June 5, 2013 19:50
Stripe month to date report
require "stripe"
require "time"
Stripe.api_key = ENV['STRIPE_KEY']
start_of_month = Time.parse(Time.now.strftime('1-%b-%Y 00:00:00 UTC'))
def created_after(object, time)
offset = 0
objects = object.all(count:100, offset: offset, created: { gte: time.to_i }).to_a
@whatupdave
whatupdave / drop_collections.js
Created April 29, 2013 21:09
Drop mongo collections with name match
var collectionNames = db.getCollectionNames();
for(var i = 0, len = collectionNames.length; i < len ; i++){
var collectionName = collectionNames[i];
if(collectionName.indexOf('logs_') == 0){
print(i + '/' + len + ':' + collectionName);
db[collectionName].drop();
}
}
@whatupdave
whatupdave / check.sh
Created March 4, 2013 20:53
Text me when Mojang updates the Minecraft server
#!/bin/bash
old_etag=$(curl --silent http://api.openkeyval.org/minecraft-etag)
new_etag=$(curl --silent --head https://s3.amazonaws.com/MinecraftDownload/launcher/minecraft_server.jar | grep ETag | awk -F\" '{print $2}')
if [ $old_etag != $new_etag ]; then
echo "event=updated old=$old_etag new=$new_etag"
curl --silent -X POST https://api.twilio.com/2010-04-01/Accounts/$TWILIO_USER/SMS/Messages.json \
-u $TWILIO_USER:$TWILIO_PASS \
-d "From=$SMS_FROM" \