This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://www.linkedin.com/feed/update/urn:li:activity:7202561717019578368?commentUrn=urn%3Ali%3Acomment%3A%28activity%3A7202561717019578368%2C7202905522717552640%29&dashCommentUrn=urn%3Ali%3Afsd_comment%3A%287202905522717552640%2Curn%3Ali%3Aactivity%3A7202561717019578368%29 | |
# Schedule A is a meeting every other Monday at 4pm | |
# Schedule B is a reminder email for the meeting sent 2 days before it | |
require "periodoxical" | |
schedule_a = Periodoxical.generate( | |
time_zone: 'America/Los_Angeles', | |
start_date: '2024-06-02', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# _____ _ _ _____ ______ ______ ______ ______ ______ ______ ______ _______ | |
# / ____| | | |_ _| ____| ____| ____| ____| ____| ____| ____|__ __| | |
# | (___ | |__| | | | | |__ | |__ | |__ | |__ | |__ | |__ | |__ | | | |
# \___ \| __ | | | | __| | __| | __| | __| | __| | __| | __| | | | |
# ____) | | | |_| |_| |____| |____| |____| |____| |____| |____| |____ | | | |
# |_____/|_| |_|_____|______|______|______|______|______|______|______| |_| | |
######################## Day 1 ################################ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# ``` | |
# which python3 | |
# pip3 install torch | |
# pip3 install transformers | |
# ``` | |
import numpy as np | |
from transformers import pipeline | |
classifier = pipeline("zero-shot-classification", model="facebook/bart-large-mnli") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# See the slowest queries right now | |
SELECT | |
pid, | |
age(clock_timestamp(), query_start) as time_running, | |
substr(query, 0, 75) | |
FROM pg_stat_activity WHERE state != 'idle' | |
ORDER BY time_running DESC; | |
# pid | time_running | query |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT state, COUNT(*) FROM pg_stat_activity | |
WHERE pid <> pg_backend_pid() | |
GROUP BY 1; | |
# state | count | |
# ---------------------+------- | |
# active | 7 | |
# idle | 569 | |
# idle in transaction | 2 | |
# | 9 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT blocked_activity.query AS blocked_statement, | |
blocking_activity.query AS current_statement_in_blocking_process | |
FROM pg_catalog.pg_locks blocked_locks | |
JOIN pg_catalog.pg_stat_activity blocked_activity ON blocked_activity.pid = blocked_locks.pid | |
JOIN pg_catalog.pg_locks blocking_locks | |
ON blocking_locks.locktype = blocked_locks.locktype | |
AND blocking_locks.database IS NOT DISTINCT FROM blocked_locks.database | |
AND blocking_locks.relation IS NOT DISTINCT FROM blocked_locks.relation | |
AND blocking_locks.page IS NOT DISTINCT FROM blocked_locks.page | |
AND blocking_locks.tuple IS NOT DISTINCT FROM blocked_locks.tuple |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
WITH table_scans as ( | |
SELECT relid, | |
tables.idx_scan + tables.seq_scan as all_scans, | |
( tables.n_tup_ins + tables.n_tup_upd + tables.n_tup_del ) as writes, | |
pg_relation_size(relid) as table_size | |
FROM pg_stat_user_tables as tables | |
), | |
all_writes as ( | |
SELECT sum(writes) as total_writes | |
FROM table_scans |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" map kj to ESC | |
imap kj <ESC> | |
" Show line numbers in editor | |
set number | |
" Shows file name in terminal window title bar | |
set title | |
" When line length exceeds editor width, content does not wrap around |
NewerOlder