View pgcat.c
#include <stdlib.h>
#include <stdint.h>
#include <stdio.h>
#include <stdbool.h>
#include <arpa/inet.h>
typedef struct buffer
uint32_t length;
uint32_t capacity;
View mach_gettime.c
#include "mach_gettime.h"
#include <mach/mach_time.h>
#define MT_NANO (+1.0E-9)
#define MT_GIGA UINT64_C(1000000000)
// TODO create a list of timers,
static double mt_timebase = 0.0;
static uint64_t mt_timestart = 0;
View postgres_queries_and_commands.sql
-- show running queries (pre 9.2)
SELECT procpid, age(query_start, clock_timestamp()), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(query_start, clock_timestamp()), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
View smartctl_prometheus_exporter.rb
HOSTNAME = %x{hostname}.chomp
PROM_FILE = ARGV[0] != 'test' ? '/var/lib/node_exporter/textfile_collector/smartctl.prom' : '/tmp/smartctl.prom'
# Usage: unpack <pathto file> <workdir>
set -e
filename=$(basename "$1")

btrfs For Beginners

I wanted to retain the original page contents just in case it went down or changed.

Taken from

This guide shows how to work with the btrfs file system on Linux. It covers creating and mounting btrfs file systems, resizing btrfs file systems online, adding and removing devices, changing RAID levels, creating subvolumes and

# Usage:
# <url to playlists>
youtube-dl \
--continue \
--retries 100 \
fn get_id(req: &mut Request) -> Option<Uuid> {
let param = req.extensions.get::<Router>().unwrap().find("id");
match param {
Some(x) => Some(Uuid::parse_str(param.unwrap()).unwrap()),
None => None