Skip to content

Instantly share code, notes, and snippets.

View slpsys's full-sized avatar
💭
💯

Marc Bollinger slpsys

💭
💯
View GitHub Profile
@dollschasingmen
dollschasingmen / redshift ddl and copy.md
Last active September 14, 2017 21:26
revisit visits

CREATE TABLE

CREATE TABLE views.web_visit_facts
(
  visit_id VARCHAR(96) ENCODE LZO,
  assignment_id VARCHAR(64) ENCODE LZO,
  ip_address VARCHAR(96) ENCODE LZO,
  country_code VARCHAR(2) ENCODE LZO,
  dma INTEGER ENCODE DELTA,
  visit_timestamp BIGINT ENCODE DELTA32K,
select
cast(use2.usename as varchar(50)) as owner,
pgc.oid,
trim(pgdb.datname) as Database,
trim(pgn.nspname) as Schema,
trim(a.name) as Table,
(b.mbytes / 1024) gbytes,
a.rows,
((case when a.rows > 0 then b.mbytes / a.rows::real end) * 1024) kb_per_row,
round(b.mbytes / (sum(b.mbytes) over ())::real * 100, 4) pct_of_cluster
@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;
@acolyer
acolyer / service-checklist.md
Last active January 30, 2024 17:39
Internet Scale Services Checklist

Internet Scale Services Checklist

A checklist for designing and developing internet scale services, inspired by James Hamilton's 2007 paper "On Desgining and Deploying Internet-Scale Services."

Basic tenets

  • Does the design expect failures to happen regularly and handle them gracefully?
  • Have we kept things as simple as possible?
@lost-theory
lost-theory / 01_intro.md
Last active March 26, 2019 15:52
Monitorama 2014 notes

Monitorama 2014 notes

http://monitorama.com/

Best talks day 1:

  • Please, no More Minutes, Milliseconds, Monoliths... or Monitoring Tools! - Adrian Cockcroft
    • gave 5 good rules for monitoring systems, showed what cloud / microservices monitoring looks like @ Netflix
  • Simple math to get some signal out of your noisy sea of data - Toufic Boubez
  • explains why static alert thresholds don't work and gave 3 techniques to use instead
@mikebroberts
mikebroberts / slack.clj
Created March 17, 2014 18:02
Send a message to Slack incoming webhook in Clojure.
(ns slack
(:require [clj-http.client :as client]
[clojure.data.json :as json]))
(defn send-to-slack
"Sends a simple message to slack using an 'incoming webhook'.
url will be of form: https://myapp.slack.com/services/hooks/incoming-webhook?token=mytoken .
(Exact url you should use will appear on the slack integration page)
text will be any valid message.
This implementation could be expanded if you wanted to specify channel, username, etc.
@brandonb927
brandonb927 / osx-for-hackers.sh
Last active March 27, 2024 06:33
OSX for Hackers: Yosemite/El Capitan Edition. This script tries not to be *too* opinionated and any major changes to your system require a prompt. You've been warned.
#!/bin/sh
###
# SOME COMMANDS WILL NOT WORK ON macOS (Sierra or newer)
# For Sierra or newer, see https://github.com/mathiasbynens/dotfiles/blob/master/.macos
###
# Alot of these configs have been taken from the various places
# on the web, most from here
# https://github.com/mathiasbynens/dotfiles/blob/5b3c8418ed42d93af2e647dc9d122f25cc034871/.osx
@slpsys
slpsys / sf_recs.md
Created July 23, 2012 00:34
Marc's SF recommendations (off the top of my head)

things to see/do

  • musée mechanique
  • if you're in the financial district, check out the old pacific stock exchange (pre-hipster fixie movie Quicksilver with Kevin Bacon was filmed here!) it is now a gym. chuckle at that thought.
  • buena vista cafe (ridiculous irish coffee, get bombed so you can handle tourists)
  • sfmoma de young/park/beach/cal academy
  • twin peaks
  • walk around SOMA, where most startups live; majority are in square bounded by [Market, 1st, Folsom, 3rd]
  • do not walk around where new Twitter HQ will be; you will step on human feces, and it is next to one of the biggest peepshow theaters
@erikh
erikh / hack.sh
Created March 31, 2012 07:02 — forked from DAddYE/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
@slpsys
slpsys / mysql_annoyances.sql
Created March 8, 2012 00:57
Herein I chronicle things that piss me off.
# Why do
DATE_DIFF('2012-3-1', '2012-3-2')
# and
DATE_ADD('2012-3-1', INTERVAL 1 DAY)
# have different naming conventions?
# this returns [0, n]
select count(*), datediff(`a`,`b`) from `table` group by datediff(`a`,`b`)
# this returns n - k, k > 0