Skip to content

Instantly share code, notes, and snippets.

View mstump's full-sized avatar
😀

Matt Stump mstump

😀
  • San Francisco, CA
View GitHub Profile
@rtbs-dev
rtbs-dev / pmml_bayesnet.ipynb
Last active March 24, 2023 16:43
Bayesian Network Models in PyMC3 and NetworkX
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@mihow
mihow / load_dotenv.sh
Last active October 20, 2025 01:05
Load environment variables from dotenv / .env file in Bash
# The initial version
if [ ! -f .env ]
then
export $(cat .env | xargs)
fi
# My favorite from the comments. Thanks @richarddewit & others!
set -a && source .env && set +a
@arsenyinfo
arsenyinfo / df_to_prom.py
Created January 17, 2017 15:30
Convert pandas DataFrame to Prometheus (https://prometheus.io) text format
from datetime import datetime
from itertools import product
from random import randint
import pandas as pd
def generate_df():
# just example
index = pd.date_range('2017-01-01', datetime.now(), freq='H')
@mardymark
mardymark / golang-decrypt-using-kms.go
Created November 29, 2016 09:37
golang-decrypt-using-kms
func decryptSecretFile(secretFile string) (string, error) {
secretBytes, err := ioutil.ReadFile(secretFile)
if err != nil {
return "", err
}
kmsClient := kms.New(session.New(&aws.Config{
Region: aws.String("us-east-1"),
}))
SNAPS=$(ls -R /app/cassandra/datastax/dse-data* | grep 1469291 | grep app)
while read -r line; do
MOVE_FROM=$(echo $line | awk -F":" '{print $1}')
#echo "MOVE_FROM = $MOVE_FROM"
TABLE_NAME=$(echo $line | awk -F"/" '{print $7}' | awk -F"-" '{print $1}')
#echo "TABLENAME = $TABLE_NAME"
@porglezomp
porglezomp / README.md
Last active May 29, 2024 09:18
Serializing Binary Data in Rust

Serializing Binary Data in Rust

The way I like to serialize data in Rust into binary formats is to let a data structure blit itself into a mutable buffer. This is a relatively composable, low level way to work that lends itself to having other abstractions built on top of it. I recently was serializing network packets, so let's make up a small packet format that illustrates how we can do this.

+-------------+-------------+
|  Tag (u16)  | Count (u16) |
+-------------+-------------+
|                           |
~        Entry (u32)        ~
@ibspoof
ibspoof / 11-cassandra-filter.conf
Last active January 6, 2021 12:23
Grok Patterns and configuration for Cassandra logs
filter {
if [type] == "cassandralog" {
grok {
break_on_match => true
match => {
"message" => [
"%{CASS_COMPACTION_LARGE_KEY}",
"%{CASS_SLAB_POOL_CLEANER_1}",
"%{CASS_SLAB_POOL_CLEANER_2}",
@eevee
eevee / perlin.py
Last active May 29, 2025 13:08
Perlin noise in Python
"""Perlin noise implementation."""
# Licensed under ISC
from itertools import product
import math
import random
def smoothstep(t):
"""Smooth curve with a zero derivative at 0 and 1, making it useful for
interpolating.
@mstump
mstump / query.sql
Last active March 10, 2016 21:31
google big table query to get most popular domains submitted to hacker news
https://bigquery.cloud.google.com/queries/hacker-news-analytics?pli=1
@Two9A
Two9A / decronym.php
Last active January 22, 2025 17:46
Decronym: A simple Reddit bot
<?php
/**
* Dirty, dirty Reddit bot: Decronym
*/
class Reddit {
const USERNAME = 'Decronym';
const PASSWORD = '***';
const CLIENTID = '***';
const SECRET = '***';