Skip to content

Instantly share code, notes, and snippets.

View dpup's full-sized avatar
💭
Building Range

Daniel Pupius dpup

💭
Building Range
View GitHub Profile
@dpup
dpup / encrypted-bucket.tf
Last active August 23, 2018 23:22
S3 Server-Side Encryption using KMS
# When specifying a named KMS Key for the S3 bucket, the default policy that
# terraform applies causes Access Denied errors for PutObject. This policy
# allows access to users with access to S3.
resource "aws_kms_key" "uploads" {
description = "Encrypts uploads stored in S3"
deletion_window_in_days = 10
policy = "${data.aws_iam_policy_document.uploads_key_policy.json}"
}

Keybase proof

I hereby claim:

  • I am dpup on github.
  • I am dpup (https://keybase.io/dpup) on keybase.
  • I have a public key whose fingerprint is 7BAA 5DDA 6FEE 47F8 EB71 51FC 2184 4463 B849 8133

To claim this, I am signing this object:

@dpup
dpup / FastMutex.js
Last active July 28, 2016 07:53
Code snippet for mutual exclusion lock in javascript.
FastMutex.prototype.runInLock = function (callback, opt_context) {
this._setX()
if (!this._isLockAvailable()) {
this._retry(callback, opt_context)
return
}
this._setY()
@dpup
dpup / index.php
Created August 3, 2014 03:16
Simple PHP file
<? echo "<p>Hello?</p>"; ?>
@dpup
dpup / apache.config
Created August 3, 2014 02:53
Simple apache config
<VirtualHost *:80>
ServerAdmin me@mydomain.com
DocumentRoot /var/www/site
<Directory /var/www/site/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order deny,allow
Allow from all
</Directory>
@dpup
dpup / Dockerfile
Last active January 16, 2022 18:22
Apache and PHP on Docker
FROM ubuntu:latest
MAINTAINER Dan Pupius <dan@pupi.us>
# Install apache, PHP, and supplimentary programs. openssh-server, curl, and lynx-cur are for debugging the container.
RUN apt-get update && apt-get -y upgrade && DEBIAN_FRONTEND=noninteractive apt-get -y install \
apache2 php7.0 php7.0-mysql libapache2-mod-php7.0 curl lynx-cur
# Enable apache mods.
RUN a2enmod php7.0
RUN a2enmod rewrite
@dpup
dpup / coreos-lb.template
Created August 3, 2014 02:31
Modified AWS Launch Config for CoreOS with a load balancer and support for private images
{
"AWSTemplateFormatVersion": "2010-09-09",
"Description": "CoreOS on EC2 with load balancer and support for private images: http://coreos.com/docs/running-coreos/cloud-providers/ec2/",
"Mappings" : {
"RegionMap" : {
"ap-northeast-1" : {
"AMI" : "ami-c1421fc0"
},
"sa-east-1" : {
"AMI" : "ami-dfbe17c2"
@dpup
dpup / hangman.go
Created April 1, 2014 03:18
Simple command line hangman game
package main
import (
"flag"
"fmt"
"io/ioutil"
"math/rand"
"strings"
"time"
)
@dpup
dpup / zip-builder.js
Created August 6, 2013 17:51
Client side ZIP file creation
/**
* @fileoverview Utility for creating Zip archives using the HTML5 Blob
* interfaces. This allows for larger files to be constructed and downloaded to
* the client.
*
* Copyright (c)2011 Daniel Pupius <pupius.co.uk>
*
* Based on JSZip from http://jszip.stuartk.co.uk
* Original licence:
* (c) 2009 Stuart Knightley <stuart [at] stuartk.co.uk>
@dpup
dpup / if-github-up.sh
Created December 11, 2012 19:30
Script that checks if GitHub is up before running a command
#!/bin/bash
#
# Script that checks GitHub's status API before continuing. If GitHub does not return "good" then
# you will be prompted whether you want to continue.
#
# Information messages are echoed to stderr so it is still possible to pipe the results of stdout to
# a file.
#
# Example Usage:
# $ if-github-up make clean