Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
💯

Marc Bollinger slpsys

💭
💯
View GitHub Profile
View redshift ddl and copy.md

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,
View redshift_size_by_table.sql
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 Dec 18, 2017
Schema + sample data for regs / subs over time SQL question
View bootstrap.sql
# 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 Sep 26, 2020
Internet Scale Services Checklist
View service-checklist.md

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 Mar 26, 2019
Monitorama 2014 notes
View 01_intro.md

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 Mar 17, 2014
Send a message to Slack incoming webhook in Clojure.
View slack.clj
(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 Sep 20, 2020
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.
View osx-for-hackers.sh
#!/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 Jul 23, 2012
Marc's SF recommendations (off the top of my head)
View sf_recs.md

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 Mar 31, 2012 — forked from DAddYE/hack.sh
OSX For Hackers
View hack.sh
#!/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 Mar 8, 2012
Herein I chronicle things that piss me off.
View mysql_annoyances.sql
# 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
You can’t perform that action at this time.