Skip to content

Instantly share code, notes, and snippets.

Avatar
🍄
My responses are limited; you must ask the right questions.

NewAlexandria

🍄
My responses are limited; you must ask the right questions.
View GitHub Profile
View machine.js
//
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
View machine.js
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@NewAlexandria
NewAlexandria / redshift-skew-finder.sql
Created Feb 19, 2020
Find Redshift tables with large skew
View redshift-skew-finder.sql
# this was provided by AWS reps
WITH base_skew AS (
SELECT id as tbl FROM stv_tbl_perm GROUP BY id
HAVING SUM(rows) > (SELECT 1000000 * ( MAX(node) + 1) FROM stv_slices)
AND (MAX(rows) / (MIN(rows) + 1.0)) >= 2.0
AND SUM(rows) <> (MAX(rows) * (SELECT MAX(node) + 1 FROM stv_slices))
),
table_slices AS (
SELECT t.slice, t.id, COUNT(b.blocknum) s_mb, COUNT(DISTINCT col) * COUNT(DISTINCT unsorted) ss_mb
View create_ec2_ssh_config.py
#!/usr/bin/python
"""AWS EC2 SSH config Generator."""
# edit these:
# * path_to_config
# * path_to_ssh_key
# remember the path_to_config must be write-able by the script
# before running, install aws_cli and login with your credentials
# then move to your .ssh folder and in your .ssh/config file
@NewAlexandria
NewAlexandria / keybase.md
Created Jan 3, 2017
keybase prove github newalexandria
View keybase.md

Keybase proof

I hereby claim:

  • I am newalexandria on github.
  • I am newalexandria (https://keybase.io/newalexandria) on keybase.
  • I have a public key ASC1Scdtf-36b4jiLY8AvgvFFqjVow1-Cnbiw43f6vzmjgo

To claim this, I am signing this object:

View bad_bandwidth_tweeter.py
#!/usr/bin/python
# from https://www.reddit.com/r/technology/comments/43fi39/i_set_up_my_raspberry_pi_to_automatically_tweet/
import os
import sys
import csv
import datetime
import time
import twitter
@NewAlexandria
NewAlexandria / pr-template.md
Last active Jan 20, 2016
test dupe from sprintly's culture repo
View pr-template.md

z

What's this PR do?

Where should the reviewer start?

How should this be manually tested?

@NewAlexandria
NewAlexandria / chord.rb
Created Jan 1, 2016 — forked from DataKinds/chord.rb
circle modular multiplication chord renderer
View chord.rb
# with reference to rendered output but the OP
# https://www.reddit.com/r/mathpics/comments/3yzu77/heres_an_animated_version_of_that_circular/
# and a video guide
# https://www.youtube.com/watch?v=qhbuKbxJsk8
require "rmagick"
RESOLUTION = 800
def localToGlobalCoords(n)
@NewAlexandria
NewAlexandria / brew_inventory.rb
Created Oct 19, 2015
A quickie copypasta for getting your main brew packages
View brew_inventory.rb
#!/usr/bin/env ruby
bl = `brew list`.split ;1
bdl = bl.reduce({}) {|h, pkg| h.merge({pkg => `brew deps #{pkg}`.split }) } ;1
bi = bl - bdl.values.flatten.sort
File.open('apps_brew.txt', 'w') {|f| f.write bi.join("\n") }
View submodules_to_neobundle.rb
File.open(".vimrc","a") do |f|
f.write File.readlines('.gitmodules')
.map(&:strip)
# remove extras
.reject do |l|
l.scan('[').any? || # submodule defs
l.scan(/^path/).any? || # submodules paths
l.empty? # blank lines
end
# remap URLs to user/repo names