Skip to content

Instantly share code, notes, and snippets.

View ryantuck's full-sized avatar
🤙
chillin'

Ryan Tuck ryantuck

🤙
chillin'
View GitHub Profile
@ryantuck
ryantuck / get-rds-metrics.sh
Created September 6, 2016 15:50
get rds metrics
aws cloudwatch get-metric-statistics \
--metric-name DatabaseConnections \
--start-time 2016-09-01T00:00:00 \
--end-time 2016-09-06T00:00:00 \
--period 3600 \
--namespace AWS/RDS \
--statistics Average \
--dimensions Name=DBInstanceIdentifier,Value=my-db-instance-identifier-name
@ryantuck
ryantuck / birthdays.py
Created August 23, 2016 20:05
calculate dumb birthdays in powers of the first 99 primes in time units from seconds to years.
import arrow
import sympy
def get_timestamps(event, context):
# get current birthday!
birth_str = event.get('birthdate', None)
@ryantuck
ryantuck / sql_to_csv.sh
Created August 19, 2016 23:51
generate a .csv from a .sql file query
#!/bin/bash
# executes a .sql file and outputs results to a .csv
# ./sql_to_csv.sh my_query.sql output.csv
CONN="psql -U my_user -d my_db"
# remove all semicolons and comments
# replace newlines with spaces
QUERY="$(sed 's/;//g;/^--/ d;s/--.*//g;' $1 | tr '\n' ' ')"
@ryantuck
ryantuck / superintelligence.md
Last active July 19, 2025 18:18
notes on superintelligence

superintelligence

"an intellect that is much smarter than the best human brains in practically every field, including scientific creativity, general wisdom and social skills."

  • artificial general intelligence, as opposed to specialized AI
  • either computer intelligence or human-augmented intelligence
  • kurzweil - not pessimistic, multiple AIs, cloud-augmented minds
  • silicon operates orders of magnitude faster (1M x) than neurons, parallelization
  • humans outperform animals in long-term planning and language use rather than biology - AI would probably do the same
  • AIs could edit and improve themselves so rapidly that we must expect a fast take-off once machines hit human-level intelligence
@ryantuck
ryantuck / sql-tricks.md
Created July 28, 2016 14:58
some helpful sql tricks

find any rows where multiple ids exist:

select
  *
from
  my_table
where
  id in (
 select
@ryantuck
ryantuck / lambda_talk.md
Created July 16, 2016 23:24
pygotham lambda talk
  • set up lambda (basic execution role)
  • just api call and return
  • incorporate boto3 writing to dynamodb
  • change input to handle date range or payload etc
  • change success message

testing in browser - woo fun, but let's make an api endpoint

  • make api endpoint with POST
  • test in browser
@ryantuck
ryantuck / pg_stat_activity.sql
Last active July 18, 2016 21:26
utils for viewing and killing queries
-- view interesting information for all queries for a user
select
pid,
client_addr,
application_name,
(current_timestamp - query_start) as duration,
state,
query
from
pg_stat_activity
@ryantuck
ryantuck / postgres-json.sql
Last active July 27, 2016 00:52
helpful postgres json queries
-- find rows where a certain key exists
select
*
from
my_table
where
json_field::jsonb ? 'key_i_want'
;
-- get certain key from json field
@ryantuck
ryantuck / postgres_information_schema_stuff.sql
Last active August 24, 2016 13:30
some helpful postgres queries regarding schemas and stuff
-- show all schema information
select * from information_schema.schemata;
-- find which schema a table is in
select
table_schema
from
information_schema.tables
where
@ryantuck
ryantuck / fermi-paradox.md
Last active February 11, 2021 23:23
notes on the fermi paradox

fermi paradox

universe is huge

  • 100b stars in milky way
  • 100b galaxies in observable universe
  • 10^22 stars available
  • sun-like stars 5-20% (est 1%)
  • possible earth-like planets 22-50% (est 10%)
  • estimate 1% of earth-like planets develop life