Skip to content

Instantly share code, notes, and snippets.

@jgould22
jgould22 / gist:f42ad756fc07143e2a104d7844f39b12
Last active March 6, 2024 13:43
Redis 7 Fluent-Bit Log parsing regex
# This is a partial regex to split a redis log line
# It will parse
# Pid
# The role (X, C, S, or M - https://github.com/redis/redis/blob/unstable/src/server.c#L130)
# Time
# level (.,-,*,# which are LOG_DEBUG, LOG_INFO, LOG_NOTICE, LOG_WARNING respectively - https://github.com/redis/redis/blob/unstable/src/server.c#L104)
# Message
[PARSER]
Name redis
@jgould22
jgould22 / non_consuming_builder.rs
Created August 9, 2022 14:04
Non Consuming Builder Pattern in rust
// Rust Builder Pattern Example that does not comsume the builder
// I used this to make api client library requests
// I stuggled a bit to figure out that I needed the outer b life time
// to satisfy the lifetimes so I am leaving this here as reference
struct Client {}
struct Foo {
x: i32,
y: i32,
@jgould22
jgould22 / Dockerfile
Last active March 18, 2024 16:06
Postgres 15 - Alpine - pg_partman with pg_jobmon
FROM postgres:15-alpine
LABEL maintainer="Jordan Gould <jordangould@gmail.com>"
# Based on https://github.com/andreaswachowski/docker-postgres/blob/master/initdb.sh
ENV PG_JOBMON_VERSION v1.4.1
ENV PG_PARTMAN_VERSION v4.7.1
# Install pg_jobmon
RUN set -ex \
\
@jgould22
jgould22 / readStdInLists
Created July 26, 2017 18:05
This reads from std in and stores the results in a list of lists using Python
import sys
list_of_lists = []
for line in sys.stdin:
new_list = [int(elem) for elem in line.split()]
list_of_lists.append(new_list)
@jgould22
jgould22 / fib.scala
Last active January 15, 2017 23:01
A simple program to calculate a Fibonacci number up to fib number 1477
object fibobject {
def fib(n: Int): Double ={
@annotation.tailrec
def fibLocalFunc(n: Int, curr: Double,prev: Double): Double ={
if(n<=0) curr
else fibLocalFunc(n-1,curr+prev, curr)