Skip to content

Instantly share code, notes, and snippets.

View austindoeswork's full-sized avatar
🐣
hatchin' a plan

austin austindoeswork

🐣
hatchin' a plan
  • San Francisco
View GitHub Profile
\set start_time '\'2018-10-15 00:00:00.0\''
\set end_time '\'2018-10-22 00:00:00.0\''
with calls as (
SELECT * FROM calls
INNER JOIN audio_minute_rate_schemes amrs on amrs.id = calls.audio_minute_rate_scheme_id
LEFT JOIN (
SELECT DISTINCT ON(call_id) rating as tqr_rating, created_at, call_id
FROM transcript_quality_ratings
ORDER BY call_id, created_at DESC
#!/usr/bin/ruby
if ARGV.length < 2
puts "USAGE: vo <table_key> <id/name>..."
exit 1
end
def compile_cmd(table, arg, id)
psql_string = "psql platform -c"
where = id ? table[:id_where] : table[:string_where]
#!/usr/bin/ruby
if ARGV.length < 2
puts "USAGE: vo <table_key> <id/name>..."
exit 1
end
def compile_cmd(table, arg, id)
psql_string = "psql platform -c"
where = id ? table[:id_where] : table[:string_where]
#!/usr/bin/ruby
def pprint(statuses)
if statuses.length == 0
puts "no statuses found"
return
end
statuses.each do |code, uid|
puts "#{code}: #{uid}"
end
#!/bin/bash
function tab() {
osascript 2>/dev/null <<EOF
tell application "System Events"
tell process "Terminal" to keystroke "t" using command down
end
tell application "Terminal"
activate
do script with command "$*" in window 1
#!/bin/bash
function tab() {
osascript 2>/dev/null <<EOF
tell application "System Events"
tell process "Terminal" to keystroke "t" using command down
end
tell application "Terminal"
activate
do script with command "$*" in window 1
now = Time.zone.now.in_time_zone("US/Pacific")
today = now.to_date
month_start = today.beginning_of_month
week_start = today.beginning_of_week
date_contexts = []
(1..4).each do |i|
d = month_start - i.month
date_contexts << {
s_date: d,
select
case when segments.confidence < 75
then '< 75'
else '> 75' end confidance,
sum(time_spent_working)::float / (sum(duration)::float / 1000.0) secs_per_audio_sec
from segments
inner join calls on calls.id = segments.call_id
where 1=1
and calls.created_at >= date_trunc('year', now())
and EXTRACT(EPOCH FROM current_timestamp-calls.occurred_at)/(3600*24) between 0 and 60
\timing
WITH
crs as (
select
cr.id as cr_id,
cr.numerator_id as cr_nid,
cr.denominator_id as cr_did,
tct.team_id as team_id,
tct.call_type_id as ct_id,
u.id as u_id
\timing
WITH
crs as (
select
cr.id as cr_id,
cr.numerator_id as cr_nid,
cr.denominator_id as cr_did,
tct.team_id as team_id,
tct.call_type_id as ct_id,
u.id as u_id