Skip to content

Instantly share code, notes, and snippets.

View pirtleshell's full-sized avatar
🕺
laniakean explorer

Robert Pirtle pirtleshell

🕺
laniakean explorer
  • Portland, OR
View GitHub Profile
@kamilhism
kamilhism / oktaverify2totp.md
Created September 10, 2022 16:18
Get TOTP secret key for Okta Verify
  1. Get the content of the QR for Okta Verify app setup. It looks like this: oktaverify://email@domain.com/?t=XXXXX&f=YYYYY&s=https://DOMAIN.okta.com&issuer=DOMAIN.okta.com&isIdxEnabled=true
  2. Replace XXXXX, YYYYY and DOMAIN to your values in curl below:
curl --request POST \
  --url https://DOMAIN.okta.com/idp/authenticators \
  --header 'Accept: application/json; charset=UTF-8' \
  --header 'Accept-Encoding: gzip, deflate' \
  --header 'Authorization: OTDT XXXXX' \
  --header 'Content-Type: application/json; charset=UTF-8' \
@mbostock
mbostock / .block
Last active March 17, 2018 17:57
Hello
license: gpl-3.0
@cpjolicoeur
cpjolicoeur / gist:3590737
Created September 1, 2012 23:15
Ordering a query result set by an arbitrary list in PostgreSQL

I'm hunting for the best solution on how to handle keeping large sets of DB records "sorted" in a performant manner.

Problem Description

Most of us have work on projects at some point where we have needed to have ordered lists of objects. Whether it be a to-do list sorted by priority, or a list of documents that a user can sort in whatever order they want.

A traditional approach for this on a Rails project is to use something like the acts_as_list gem, or something similar. These systems typically add some sort of "postion" or "sort order" column to each record, which is then used when querying out the records in a traditional order by position SQL query.

This approach seems to work fine for smaller datasets, but can be hard to manage on large data sets with hundreds (or thousands) of records needing to be sorted. Changing the sort position of even a single object will require updating every single record in the database that is in the same sort group. This requires potentially thousands of wri