Skip to content

Instantly share code, notes, and snippets.

View slpsys's full-sized avatar
💭
💯

Marc Bollinger slpsys

💭
💯
View GitHub Profile
@slpsys
slpsys / xkcd_tiles.txt
Created September 19, 2012 15:35
I'm not clicking and dragging. Sorry, Randall.
http://imgs.xkcd.com/clickdrag/1n2e.png
http://imgs.xkcd.com/clickdrag/2n3e.png
http://imgs.xkcd.com/clickdrag/1n3e.png
http://imgs.xkcd.com/clickdrag/3n2e.png
http://imgs.xkcd.com/clickdrag/3n3e.png
http://imgs.xkcd.com/clickdrag/2n4e.png
http://imgs.xkcd.com/clickdrag/1n4e.png
class Player
private_class_method :new
class << self
def one ; 1 ; end
def two ; 2 ; end
end
end
class TTTEngine
@slpsys
slpsys / 1-1
Created January 7, 2019 23:57
101 1-on-1 questions script
#!/bin/bash -ew
# Note that the question file accompanying this script came from
# Jason Evanish's excellent blog post, the original text of which can
# be which can be found here:
#
# https://jasonevanish.com/2014/05/29/101-questions-to-ask-in-1-on-1s/
# Number of questions to ask
NUM_QUESTIONS=3
@slpsys
slpsys / keybase.md
Created July 18, 2018 22:26
keybase.md

Keybase proof

I hereby claim:

  • I am slpsys on github.
  • I am slpsys (https://keybase.io/slpsys) on keybase.
  • I have a public key whose fingerprint is 8CFC 55BC E288 6D63 FFD7 499F 1B05 8607 4149 659D

To claim this, I am signing this object:

@slpsys
slpsys / crap_tables.sql
Last active May 4, 2018 20:03
Query large (20GB on-cluster, for us) Redshift tables that are missing sort keys or are not diststyle key
SELECT
TRIM(pgn.nspname) AS schema,
TRIM(a.name) AS table,
CASE WHEN pgc.reldiststyle != 1 AND ti.sortkey_num = 0 THEN 'DISTSTYLE NOT KEY AND NO SORTKEY (TABLE IS GARBAGE)'
WHEN pgc.reldiststyle != 1 THEN 'DISTSTYLE NOT KEY'
WHEN ti.sortkey_num = 0 THEN 'NO SORTKEY'
END as issue
FROM
(
SELECT db_id, id, name, SUM(rows) AS rows

Keynote, "I See What You Mean" by Peter Alvaro

Synopsis

5/5. This is pretty academic, but it's pretty great, too. It starts with datalog, which heavily inspires his project Dedalus; there's a way better dissection of this talk here.

"Managing Containers at Scale with CoreOS and Kubernetes" by Kelsey Hightower

@slpsys
slpsys / bootstrap.sql
Last active December 18, 2017 21:28
Schema + sample data for regs / subs over time SQL question
# Drop the Coderpad default tables
drop table if exists alerts;
drop table if exists departments;
drop table if exists employees;
drop table if exists employees_projects;
drop table if exists projects;
drop table if exists sales;
drop table if exists signup_flow_events;
drop table if exists stores;
drop table if exists products;
@slpsys
slpsys / fizzBuzzStream.scala
Last active December 12, 2017 21:54
Because always moar.
object fizzBuzzStream extends App {
type FizzBuffer = (Int, String)
def fb(b: FizzBuffer)(i:Int, s:String) = if (b._1 % i == 0) { new FizzBuffer(b._1, b._2 + s) } else { b }
def fizz = fb(_:FizzBuffer)(3, "Fizz")
def buzz = fb(_:FizzBuffer)(5, "Buzz")
def fizzBuzz = fizz andThen buzz
val naturals: Stream[Int] = 1 #:: naturals.map {n => n + 1}
val fizzyStream = naturals.map(n => fizzBuzz(new FizzBuffer(n, "")))
@slpsys
slpsys / redshift_sort_key_filter.md
Last active November 26, 2017 17:39
AWS Redshift - Filtering on a sort key

Execution plans

EXTRACT (YEAR FROM date_field) for a given year:

warehouse=# explain select count(*) from views.gamesave where EXTRACT (YEAR FROM event_created_at) = 2016;
                                 QUERY PLAN
-----------------------------------------------------------------------------
 XN Aggregate  (cost=8152608.99..8152608.99 rows=1 width=0)
   ->  XN Seq Scan on gamesave  (cost=0.00..8145820.80 rows=2715274 width=0)