Skip to content

Instantly share code, notes, and snippets.

@nickreese
nickreese / check_rls_by_role.sql
Last active April 6, 2023 17:55
Check Postgres RLS Policies by Role Query
WITH
rls_enabled_tables AS (
SELECT nspname AS schema_name, relname AS table_name
FROM pg_class c
JOIN pg_namespace n ON n.oid = c.relnamespace
WHERE c.relkind = 'r' AND c.relrowsecurity = 't'
),
rls_policies AS (
SELECT p.polrelid, p.polname, p.polcmd, p.polroles
FROM pg_policy p
@nickreese
nickreese / ffmpeg-cheatsheet.md
Created February 20, 2023 13:47 — forked from nickkraakman/ffmpeg-cheatsheet.md
FFmpeg cheat sheet for 360 video

FFmpeg Cheat Sheet for 360º video

Brought to you by Headjack

 
FFmpeg is one of the most powerful tools for video transcoding and manipulation, but it's fairly complex and confusing to use. That's why I decided to create this cheat sheet which shows some of the most often used commands.

 
Let's start with some basics:

  • ffmpeg calls the FFmpeg application in the command line window, could also be the full path to the FFmpeg binary or .exe file
@nickreese
nickreese / cleanStacktrace.js
Created May 12, 2022 14:38
Clean Stacktraces In JS
function cleanStack(stack) {
const parts = path.resolve('./').split('/');
let str = stack.toString();
for (const part of parts) {
const r = new RegExp(`/${part}/`, `gim`);
str = str.replace(r, '/');
}
return str;
}
@nickreese
nickreese / gist:200b950b1e7c106910ecc62511d2b0f0
Last active November 3, 2020 11:35
Svelte Partial Hydration Wishlist

My Context on Partial Hydration

When you first start trying to figure out SSR with the goal of partial hydration like I did, you find it is complex for two reasons:

  1. You figure out which components you need to mount.
  2. You need to mount them with the right props.

At first this seems relatively simple, but there are some non-obvious pitfalls.

Here are my thoughts from building Elder.js and solving these problems.

@nickreese
nickreese / sync_db.sh
Last active December 22, 2021 03:34
Sync Postgres Production with Local Database
#!/bin/bash
if [ -f .env ]
then
export $(cat .env | sed 's/#.*//g' | xargs)
fi
echo 'Dropping the local db';
PGPASSWORD=$LOCAL_POSTGRES_PASSWORD psql -h $LOCAL_POSTGRES_HOST -p $LOCAL_POSTGRES_PORT -U $LOCAL_POSTGRES_USER $LOCAL_POSTGRES_DB -c "DROP DATABASE $LOCAL_POSTGRES_DB;"
wait

Keybase proof

I hereby claim:

  • I am nickreese on github.
  • I am nickreese (https://keybase.io/nickreese) on keybase.
  • I have a public key ASBikqdyYV2Uw-LX-Mm8nU3yDXSn8WMqi9H8s6tzK2YfeQo

To claim this, I am signing this object: