Skip to content

Instantly share code, notes, and snippets.

View dan-passaro's full-sized avatar

Dan Passaro dan-passaro

  • Philadelphia, PA
View GitHub Profile
@dan-passaro
dan-passaro / create-sample
Last active February 16, 2021 23:43
terraform plan -no-color sample
An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
+ create
Terraform will perform the following actions:
# aws_instance.example will be created
+ resource "aws_instance" "example" {
+ ami = "ami-2757f631"
@dan-passaro
dan-passaro / part_one.py
Last active December 8, 2018 01:58
Advent of Code 2018 Day 5 Part 1 broken solution
import sys
import time
from polymer import Polymer
class NullStatusDisplayer(object):
def show_status(self):
pass
@dan-passaro
dan-passaro / dan_formatter.py
Created August 22, 2017 12:42
Verbose Python JSON logging for local dev
import json
import logging
def recursive_dict(obj, converted_objs=()):
converted_objs = converted_objs or set()
try:
attrs = obj.__dict__
except AttributeError:
if isinstance(obj, dict):
@dan-passaro
dan-passaro / tocsv
Last active December 9, 2016 17:53
Convert spreadsheets to CSV using LibreOffice Calc, even with a window open
#!/usr/bin/perl
use 5.014;
use Cwd;
use File::Temp ();
use File::Spec;
my $file = $ARGV[0] or die "Provide a file to convert.\n";
my $tempdir = File::Temp->newdir;
my $profile = File::Spec->catdir($tempdir, "profile");
@dan-passaro
dan-passaro / my_flatten.rb
Created May 22, 2016 21:19
A simple re-implementation of Array#flatten. Run tests with rspec
class Array
# Get a one-dimensional array by combining elements of nested arrays.
#
# ==== Examples
#
# [[3, 4], 5, [[6, 7, 8], 9]] #=> [3, 4, 5, 6, 7, 8, 9]
#
def my_flatten
result = []
$ cat irc.rb
require 'haml'
template = <<EOF
- if false
%p In the if
- else
%p In the else
EOF