Skip to content

Instantly share code, notes, and snippets.

View tylerpearson's full-sized avatar

Tyler Pearson tylerpearson

View GitHub Profile
@tylerpearson
tylerpearson / yc-founders-1000.md
Created October 7, 2013 01:20
1000 most followed Twitter accounts by founders of Y Combinator-backed companies
@tylerpearson
tylerpearson / copy_github_labels.rb
Last active January 11, 2022 15:27
Super simple script to copy Github tag labels from one repository to another. Uses the Octokit gem.
require 'octokit'
# https://help.github.com/articles/creating-an-access-token-for-command-line-use/
client = Octokit::Client.new(:access_token => "getmefromgithub")
COPY_FROM_REPO = "repo/old"
COPY_TO_REPO = "repo/new"
current_labels = client.labels(COPY_FROM_REPO)
@tylerpearson
tylerpearson / wv-alec-bill-comparision-2016.md
Last active July 25, 2019 07:16
Text similarity comparison between bills introduced during the 2016 WV Regular Legislative session and ALEC model legislation bills
Bill # WV bill name ALEC Bill Name Similarity
hb2911 Voluntary Political Contribution Act Voluntary Contributions (Paycheck Protection) Act 13
hb4261 Prohibiting the sale or transfer of student data to vendors and other profit making entities Student Data Accessibility, Transparency, and Accountability Act 13
sb407 Increasing high-quality educational opportunities in public school system Public Charter School Authorizing and Accountability Act 14
hb4011 Providing for the authorization and oversight of public charter schools Public Charter School Authorizing and Accountability Act 14
sb541 Requiring agencies analyze impact of proposed and existing regulations on small business Regulatory Flexibility Act 17
hb4716 Requiring community corrections performance measurement standards for agencies responsible for supervising individuals placed on probation Community Corrections Performance Measurement Act 17
hb4162 Expiring funds to the unappropriated
SELECT SCHEMA schemaname,
"table" tablename,
table_id tableid,
size size_in_mb,
CASE
WHEN diststyle NOT IN ('EVEN','ALL') THEN 1
ELSE 0
END has_dist_key,
CASE
WHEN sortkey1 IS NOT NULL THEN 1
@tylerpearson
tylerpearson / redshift-vacuuming.sql
Created March 16, 2017 20:19
redshift vacuuming
SELECT trim(pgdb.datname) AS Database,
trim(a.name) AS Table, ((b.mbytes/part.total::decimal)*100)::decimal(5,2) AS pct_of_total, b.mbytes, b.unsorted_mbytes
FROM stv_tbl_perm a
JOIN pg_database AS pgdb ON pgdb.oid = a.db_id
JOIN (SELECT tbl, sum(decode(unsorted, 1, 1, 0)) AS unsorted_mbytes, count(*) AS mbytes
FROM stv_blocklist GROUP BY tbl) b ON a.id=b.tbl
JOIN ( SELECT sum(capacity) AS total
FROM stv_partitions WHERE part_begin=0 ) AS part ON 1=1
WHERE a.slice=0
ORDER BY 3 desc, db_id, name;
@tylerpearson
tylerpearson / redshift-table-sizes.sql
Created March 14, 2017 16:29
sizes of tables in redshift
SELECT TRIM(pgdb.datname) AS Database,
TRIM(a.name) AS Table,
((b.mbytes/part.total::decimal)*100)::decimal(5,2) AS pct_of_total,
b.mbytes,
b.unsorted_mbytes
FROM stv_tbl_perm a
JOIN pg_database AS pgdb
ON pgdb.oid = a.db_id
JOIN ( SELECT tbl,
SUM( DECODE(unsorted, 1, 1, 0)) AS unsorted_mbytes,
@tylerpearson
tylerpearson / sidekiq
Created August 18, 2016 21:59
restart rsyslog with logrotate on ubuntu. Even with copytruncate, rsyslog needed a restart to get the latest in the log
/var/www/site/shared/log/sidekiq.log {
missingok
daily
rotate 7
compress
delaycompress
notifempty
copytruncate
postrotate
sudo /etc/init.d/rsyslog restart
Bill # WV bill name ALEC Bill Name Similarity
sb407 Increasing high-quality educational opportunities in public school system Public Charter School Authorizing and Accountability Act 14
hb4011 Providing for the authorization and oversight of public charter schools Public Charter School Authorizing and Accountability Act 14
hb4449 Creating the Compact for a Balanced Budget Compact for America: Balanced Budget Amendment 15
hb4030 Updating the meaning of federal adjusted gross income and certain other terms used in the West Vi
Bill # WV bill name ALEC Bill Name Similarity
hb2092 Adding certain sanctions for violations of probation and parole Swift and Certain Sanctions Act 7
sb629 Limiting liability of landowners, operators and contractors in water pollution abatement projects The Environmental Good Samaritan Act 13
hb2080 Requiring community corrections performance measurement standards for agencies responsible for supervising individuals placed on probation, serving a period of parole Community Corrections Performance Measurement Act 13
hb3044
Bill # WV bill name ALEC Bill Name Similarity
hb3260 Adding certain sanctions for violations of probation and parole Swift and Certain Sanctions Act 6
hb2324 Special Needs Scholarship Program The Special Needs Scholarship Program Act 13
hb3051 The Parent Empowerment and Choice Act Parent Trigger Act 14
hb3206 Implementing evidence-based practices to reduce recidivism Recidivism Reduction Act 15
hb3212 Requ