Skip to content

Instantly share code, notes, and snippets.

View BrianMehrman's full-sized avatar
🏠
Working from home

Brian Mehrman BrianMehrman

🏠
Working from home
View GitHub Profile
@BrianMehrman
BrianMehrman / prettySQL.py
Last active July 5, 2018 20:10
pretty print your SQL
#!/usr/bin/env python
import argparse
import sys
import sqlparse
from pygments import highlight
from pygments.lexers import get_lexer_by_name
from pygments.formatters import TerminalTrueColorFormatter
def prettyPrint(raw_sql):
man dmesg
Get is list of killed processes
```
dmesg -TL
```
@BrianMehrman
BrianMehrman / configmap.yaml
Last active August 12, 2021 19:04
These are instructions to start a mongo db deployment. Assuming these files are all in the same directory you can run this ``` kubectl apply -k . ```
apiVersion: v1
kind: ConfigMap
metadata:
name: mongo-configmap
labels:
app: meal-plan-app
component: mongo-db
data:
MONGO_INITDB_ROOT_USERNAME: root
MONGO_INITDB_ROOT_PASSWORD: rootR0xks
**Patreon**(http://www.patreon.com/) is a service that connects **patrons** with **creators**. A creator promises to produce creations; these could be videos, songs, podcast episodes, comics, or anything else that can be delivered digitally.
Each patron is automatically a creator if they create a **creator's** **page**. A creator charges patrons **per creation** or **per month** (of creations). A creator creates **posts** for their page (think "blog").  A post has content (displayed in a feed of posts); some posts have a creation that needs to be billed.
The creator also establishes **reward** **tiers** for their page (e.g., $1 per whatever, $5 per whatever, $25 per whatever). A patron chooses a tier *and* an amount for their pledge; they must pledge as much or *more* than their reward tier.  A post is either public or linked to a reward tier. The content of public posts can be seen by everyone, even visitors not logged in; the content of posts tied to a reward tier can be seen by a patron at that tier or h
@BrianMehrman
BrianMehrman / get_processes.sql
Created December 12, 2024 15:36
Get the current running postgres processes
SELECT user, pid, client_addr, wait_event, query, query_start, NOW() - query_start AS elapsed
FROM pg_stat_activity
WHERE query != '<IDLE>'
-- AND EXTRACT(EPOCH FROM (NOW() - query_start)) > 1
ORDER BY elapsed DESC;