Skip to content

Instantly share code, notes, and snippets.

@ericbmerritt
ericbmerritt / Makefile
Last active August 11, 2023 09:35
Universal drop in Makefile for Erlang projects that use rebar
# Copyright 2012 Erlware, LLC. All Rights Reserved.
#
# This file is provided to you under the Apache License,
# Version 2.0 (the "License"); you may not use this file
# except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
@ericbmerritt
ericbmerritt / gist:4013729
Created November 4, 2012 20:53
A script to generate a valid semver version in any git repo
#!/bin/bash
#
# If run inside a git repository will return a valid semver based on
# the semver formatted tags. For example if the current HEAD is tagged
# at 0.0.1, then the version echoed will simply be 0.0.1. However, if
# the tag is say, 3 patches behind, the tag will be in the form
# `0.0.1+build.3.0ace960`. This is basically, the current tag a
# monotonically increasing commit (the number of commits since the
# tag, and then a git short ref to identify the commit.
#
@ericbmerritt
ericbmerritt / git-semver.sh
Created July 30, 2014 21:04
Shell script for parsing semvers from git-describe
#! /bin/bash
# Assumes that you tag versions with the version number (e.g., "1.1")
# and then the build number is that plus the number of commits since
# the tag (e.g., "1.1.17")
DESCRIBE=`git describe --tags --always`
# increment the build number (ie 115 to 116)
VERSION=`echo $DESCRIBE | awk '{split($0,a,"-"); print a[1]}'`
query foo($l: String!) {
user(login: $l) {
login
name
email
location
websiteUrl
avatarUrl
bio
bioHTML
export PROJECT_ROOT := $(shell pwd)
VERSION := $(shell "${PROJECT_ROOT}/docker/src/git-version.sh")
DEV_COMPOSE:="${PROJECT_ROOT}/docker/dev.compose.yml"
SHFMT=shfmt -i 2 -ci
RUN_IN_CONTAINER="${PROJECT_ROOT}/bin/run-in-container.sh" "${DEV_COMPOSE}"
export PROJECT_ROOT := $(shell pwd)
{-# LANGUAGE DeriveGeneric, OverloadedStrings, DeriveAnyClass #-}
{-# LANGUAGE TemplateHaskell, NamedFieldPuns, LambdaCase #-}
{-# LANGUAGE RankNTypes, TypeOperators, Strict #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-| For each simulation, every person is randomly assigned a task, and
normally randomly decides how long each task ends up taking for this
particular simulation; it then walks forward in time until the first
person (or people) complete their task, at which point it randomly
assigns new tasks from the remaining, chooses normal random numbers
import loglevel from 'loglevel';
import { gaussian, randomBetweenMinAndMax } from './random-utils';
interface IPeriodEntry {
calories: number;
workout: boolean;
}
interface ISimEntry {
correctnessFactor: number;
period: IPeriodEntry[];
@ericbmerritt
ericbmerritt / cd-acme.bash
Created October 15, 2015 20:42
customized cd command for 'win' shell of the acme editor
#
# Fix the cd command for use with acme
#
cd() {
builtin cd $1 && awd
}
https://git.gnu.io/chreekat/yesod/commit/41faf62094ad7077573de797599c742ff9401c4e
> mkYesod "HW" [$parseRoutes|
> / RootR GET
> /form FormR
> /static StaticR Static hwStatic
> /autocomplete AutoCompleteR GET
----
handleFormR = do
> (res, form, enctype, nonce) <- runFormPost $ fieldsToTable $ (,,,,,,,,)
with import <nixpkgs> {};
with import <nixhome> { inherit stdenv; inherit pkgs; };
let
toBin = pkg: "${pkg}/bin";
localPkgs = [ tmux
awscli
sbt
jq
moreutils