Skip to content

Instantly share code, notes, and snippets.

Enjoying life

Matthew Johnston warmwaffles

Enjoying life
View GitHub Profile
warmwaffles /
Created Apr 4, 2021
Loads a dotenv file definition into the current fish shell
function dotenv -a filePath -d 'exports all .env entries to global'
if not test -f $filePath
echo Error: file $filePath does not exist or can not be read
echo Parsing dotenv file $filePath
for entry in (cat $filePath | grep -v '^#' | grep -v '^$')
set entry = (string split -m 1 \= -- $entry)
View Makefile
# Some help text here
@echo boooo
# Show this help.
@python $(MAKEFILE_LIST)
warmwaffles /
Created Oct 26, 2020
Organize GoPro Hero7 files.
Works primarily only with GoPro Hero 7 at the moment.
GoPro has a really weird naming scheme and terrible pattern for timelapse and
videos. This tool helps move files into a usable / navigable directory.
import argparse
import os
import re
warmwaffles /
Last active Oct 17, 2020
Convert go-pro timelapse with ffmpeg

To compile all of the gopro timelapse images use the following command.

ffmpeg -r 6 \
  -f image2 \
  -pattern_type glob \
  -i '*.JPG' \
  -s 4000x3000 \
  -c:v mjpeg \
  -q:v 10 \
warmwaffles / defer.c
Created Sep 30, 2020 — forked from jart/defer.c
Go-like defer for C that works with most optimization flag combinations under GCC/Clang
View defer.c
#include "gc.h"
* Adds destructor to garbage shadow stack.
* @param frame is passed automatically by wrapper macro
* @param fn takes one argument
* @param arg is passed to fn(arg)
* @return arg
warmwaffles / docker-compose.yml
Last active Nov 19, 2020
postgres, elasticsearch, redis, kibana docker compose file
View docker-compose.yml
# This is purely a development setup. DO NOT RUN THIS IN PRODUCTION
version: '3.7'
# NOTE: You will need to up the max map count on your system
# sudo sysctl -w vm.max_map_count=262144
image: elasticsearch:7.9.3
container_name: elasticsearch
View schema.ex
defmodule MyApp.Schema do
defmacro __using__(_) do
quote do
use Ecto.Schema
import Ecto
import Ecto.Changeset
@primary_key {:id, :binary_id, autogenerate: true}
@foreign_key_type :binary_id
# Inserts a new desktop for bspwm
bspc monitor -a (printf "desktop-%s" bspc query -m -D | wc -l)
View example.ex
defp word_to_code(word) do
String.codepoints(word) # ["J", "a", "v", "a"]
|> # ["J", "A", "V", "A"]
|> # [5, 2, 8, 2]
|> Enum.join() # "5282"
defp something(char) do
|> Enum.find(fn {str, index} -> char == str end)
View PKGBUILD.aseprite
# Maintainer: Wilson E. Alvarez <>
# Contributor: Benoit Favre <>
# Contributor: Alexander Rødseth <>
# Contributor: Kamil Biduś <>
pkgdesc='Create animated sprites and pixel art'
arch=('x86_64' 'i686')