Skip to content

Instantly share code, notes, and snippets.

View trentonstrong's full-sized avatar

Trent Strong trentonstrong

View GitHub Profile
### Keybase proof
I hereby claim:
* I am trentonstrong on github.
* I am trentonstrong (https://keybase.io/trentonstrong) on keybase.
* I have a public key whose fingerprint is 0A96 0B07 9436 C9FC 4DDE 05EF 50C2 BF5C 19EA 647F
To claim this, I am signing this object:
@trentonstrong
trentonstrong / gist:32aeb43328da018ee1c3
Last active August 29, 2015 14:14
tableau / redshift very inefficient query
EXPLAIN SELECT CAST("optimization_output_flow_view"."destination_site_name" AS TEXT) AS "none_destination_site_name_nk",
CAST("optimization_output_flow_view"."destination_site_type" AS TEXT) AS "none_destination_site_type_nk",
CAST("optimization_output_flow_view"."source_site_name" AS TEXT) AS "none_source_site_name_nk",
SUM("optimization_output_flow_view"."flow_amount") AS "sum_flow_amount_ok",
SUM("optimization_output_flow_view"."flow_cost") AS "sum_flow_cost_ok"
FROM "public"."optimization_output_flow_view" "optimization_output_flow_view"
WHERE(0=1)
GROUP BY 1, 2, 3
HAVING ((SUM("optimization_output_flow_view"."flow_amount") >= 0)
AND (SUM("optimization_output_flow_view"."flow_amount") <= 711859));
@trentonstrong
trentonstrong / epic_debug_sesh.md
Last active August 29, 2015 14:27
epic debug sesh

Our freshly minted Haskell apps running inside Nix closures on AMIs are somehow throwing "Connection refused errors" on addresses and ports that are very much open and telnettable from the machine...

The strace cap

connect(3, {sa_family=AF_INET, sin_port=htons(9092), sin_addr=inet_addr("52.20.114.33")}, 16) = -1 EINPROGRESS (Operation now in progress)
clock_gettime(CLOCK_MONOTONIC, {2267, 491936504}) = 0
select(4, [], [3], NULL, {0, 988827})   = 1 (out [3], left {0, 987760})
getsockopt(3, SOL_SOCKET, SO_ERROR, [0], [4]) = 0
fcntl(3, F_GETFL)                       = 0x802 (flags O_RDWR|O_NONBLOCK)
extern crate timely;
use timely::dataflow::*;
use timely::dataflow::operators::{Input, Inspect};
use std::io::{self, BufRead};
fn main() {
// initializes and runs a timely dataflow computation
timely::execute_from_args(std::env::args(), |root| {
@trentonstrong
trentonstrong / tree.hs
Created September 6, 2015 02:22
prints a tree from the current dir
import Control.Monad (liftM)
import Data.Tree
import System.Directory (doesDirectoryExist, getDirectoryContents)
import System.FilePath ((</>), takeFileName)
children :: [FilePath] -> [FilePath]
children = filter (\ p -> p /= "." && p /= ".." )
listDirectory :: FilePath -> IO [FilePath]
listDirectory path = liftM children $ getDirectoryContents path
@trentonstrong
trentonstrong / gist:1186969
Created September 1, 2011 19:02
tech interview project
Weight Widget Project
=====================
To get a good example of how you work and approach design and problem solving, we would like you to design and build
for us a relatively simple "weight widget". This document will act as a rough specification for the widget, but you are encouraged
to wear your creative thinking hat. In order to minimize the amount of external requirements for this project, the widget itself
should be built in Javascript and rendered in the browser using the HTML and CSS.
The code can be uploaded to Github or your code repository of choice, as long
as we can be provided access to it to review. The main HTML file of the project should be named index.html, but the rest of the project's
@trentonstrong
trentonstrong / gist:1288140
Created October 14, 2011 20:00
Best thing anyone ever built
require 'chef/knife'
require 'net/ssh'
require 'net/ssh/multi'
require 'readline'
SYMFONY_BIN = "/home/ubuntu/ichange.com/skylight/symfony"
def send_ssh(node, command)
knife_ssh = Chef::Knife::Ssh.new
knife_ssh.config[:identity_file] = "~/ichangekey.pem"
@trentonstrong
trentonstrong / gist:1390212
Created November 23, 2011 23:14
My First Ruby Class
require 'chef/shef/ext'
require 'net/ssh'
require 'net/ssh/multi'
require 'readline'
module IchangeKnifePlugins
PROJECT_HOME = "/home/ubuntu/ichange.com"
SYMFONY_BIN = "#{PROJECT_HOME}/skylight/symfony"
@trentonstrong
trentonstrong / gist:3779646
Created September 25, 2012 02:30
Only 1 failure!
vagrant@lucid32:/vagrant$ arruspekku
..................................................................................................................................................F..................
Failures:
1) omniauth redirects to the specified callback url
Failure/Error: click_button "Allow"
Faraday::Error::ConnectionFailed:
end of file reached
# (eval):3:in `each'
[Main]
# The host of the Datadog intake server to send Agent data to
dd_url: https://app.datadoghq.com
# If you need a proxy to connect to the Internet, provide the settings here
# proxy_host: my-proxy.com
# proxy_port: 3128
# proxy_user: user
# proxy_password: password