Skip to content

Instantly share code, notes, and snippets.

awsiv / queries.sql
Last active Feb 12, 2020
SQL queries
View queries.sql
--- select indexes
SELECT tablename, indexname, indexdef FROM pg_indexes WHERE schemaname = 'public' ORDER BY tablename, indexname;
--- list functions
\df public.*
--- list lastvalue
SELECT MAX(id) FROM <table name>;
awsiv / remove_old_data.c
Created Mar 15, 2012
Remove data older than a certain time period from an array
View remove_old_data.c
//gcc -static -std=c99 -Wall remove_old_data.c -I./src -L. -lbson -lmongoc -o remove_old_data
/* remove_old_data.c */
#include "bson.h"
#include "mongo.h"
int main() {
bson_buffer bb;
bson cond;
awsiv / compressed.c
Created Mar 14, 2012
Compression by timestamp
View compressed.c
//gcc -static -std=c99 -Wall compressed_data.c -I./src -L. -lbson -lmongoc -o compressed_data
/* compressed_promiselog.c */
#include "bson.h"
#include "mongo.h"
int main() {
bson b, key, setOp;
bson_buffer bb;
You can’t perform that action at this time.