Skip to content

Instantly share code, notes, and snippets.

View pauldevos's full-sized avatar
👋

Paul DeVos pauldevos

👋
View GitHub Profile
@pauldevos
pauldevos / README.md
Created June 23, 2021 17:02 — forked from takemikami/README.md
terraform for mwaa
@pauldevos
pauldevos / unfollow.js
Created August 27, 2020 01:32 — forked from JamieMason/unfollow.js.md
Unfollow everyone on twitter.com
// Unfollow everyone on twitter.com, by Jamie Mason (https://twitter.com/fold_left)
// https://gist.github.com/JamieMason/7580315
//
// 1. Go to https://twitter.com/YOUR_USER_NAME/following
// 2. Open the Developer Console. (COMMAND+ALT+I on Mac)
// 3. Paste this into the Developer Console and run it
//
// Last Updated: 09 April 2020
(() => {
const $followButtons = '[data-testid$="-unfollow"]';
@pauldevos
pauldevos / jupyter_notebook_config.py
Created November 23, 2019 19:42 — forked from binaryfunt/jupyter_notebook_config.py
Jupyter notebooks - clear output pre-save hook (for cleaner git diffs)
# This file has to be saved in your Jupyter config directory (found by running
# jupyter --config-dir
# but usually C:\Users\<username>\.jupyter\jupyter_notebook_config.py on Windows
def scrub_output_pre_save(model, **kwargs):
"""scrub output before saving notebooks"""
# only run on notebooks
if model['type'] != 'notebook':
return
# only run on nbformat v4
@pauldevos
pauldevos / travis.yml
Created July 2, 2019 20:05 — forked from teddyrendahl/travis.yml
Travis for basic CONDA installation and deployment
language: python
matrix:
# This will launch a separate build for each Python version you add
# Feel free to add extra environment variables as needed
include:
- python: 3.5
- python: 3.6
before_install:
@pauldevos
pauldevos / postgres_queries_and_commands.sql
Created October 31, 2018 04:21 — forked from virusdave/postgres_queries_and_commands.sql
Useful PostgreSQL Queries and Commands
-- CHECK TIMINGS ON ACTIVE AND EXPENSIVE QUERIES
SELECT activity.*
FROM (
SELECT
pid,
CASE WHEN state = 'active' THEN AGE(clock_timestamp(), query_start)
ELSE AGE(state_change, query_start)
END as query_duration, -- This is how long the most recent query was running (or is running so far, if still active)
AGE(clock_timestamp(), xact_start) as xact_duration, -- Same, but for the currently active transaction
CASE WHEN state = 'active' THEN INTERVAL '0'
@pauldevos
pauldevos / statistics.sql
Created October 31, 2018 04:20 — forked from ruckus/statistics.sql
Postgres statistics queries
** Find commmonly accessed tables and their use of indexes:
SELECT relname,seq_tup_read,idx_tup_fetch,cast(idx_tup_fetch AS numeric) / (idx_tup_fetch + seq_tup_read) AS idx_tup_pct FROM pg_stat_user_tables WHERE (idx_tup_fetch + seq_tup_read)>0 ORDER BY idx_tup_pct;
Returns output like:
relname | seq_tup_read | idx_tup_fetch | idx_tup_pct
----------------------+--------------+---------------+------------------------
schema_migrations | 817 | 0 | 0.00000000000000000000
user_device_photos | 349 | 0 | 0.00000000000000000000
with table_stats as (
select psut.relname,
psut.n_live_tup,
1.0 * psut.idx_scan / greatest(1, psut.seq_scan + psut.idx_scan) as index_use_ratio
from pg_stat_user_tables psut
order by psut.n_live_tup desc
),
table_io as (
select psiut.relname,
sum(psiut.heap_blks_read) as table_page_read,
@pauldevos
pauldevos / mongodb.md
Created June 1, 2016 03:17 — forked from artieziff/mongodb.md
MongoDb & Python Essentials

##MONGODB & PYTHON

###Ubuntu Install

sudo apt-get install mongodb
pip install pymongo

Table - Collection
Column - Property
Row - Document

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.