Skip to content

Instantly share code, notes, and snippets.

@ianpgall
ianpgall / postgres-view-functions.sql
Created March 11, 2014 19:05
PostgreSQL view that lists all functions and their source code
create or replace view showfunctions as
select
l.lanname,
t.typname || ' = ' || n.nspname || '.' ||
p.proname || '(' || pg_catalog.oidvectortypes(p.proargtypes) || ')'
as function_definition,
(select case when lanname <> 'c'
then '\n\n'||prosrc ||'\n\n'
else '\n'||prosrc ||'.so\n\n'
end) as source
@Stanback
Stanback / nginx.conf
Last active March 30, 2025 03:57 — forked from michiel/cors-nginx.conf
Example Nginx configuration for adding cross-origin resource sharing (CORS) support to reverse proxied APIs
#
# CORS header support
#
# One way to use this is by placing it into a file called "cors_support"
# under your Nginx configuration directory and placing the following
# statement inside your **location** block(s):
#
# include cors_support;
#
# As of Nginx 1.7.5, add_header supports an "always" parameter which
@jboner
jboner / latency.txt
Last active May 5, 2025 12:23
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD