Skip to content

Instantly share code, notes, and snippets.

@zemm
zemm / show-missing.md
Last active April 22, 2021 23:12
Show files missing from a sequence

Show files missing from a sequence

First let's have a broken sequence of files:

➜ touch page-{1,2,5}.jpg

➜ ls
page-1.jpg  page-2.jpg  page-5.jpg  show-missing.sh
@zemm
zemm / Simple.hs
Created April 23, 2019 16:46
Suites
-- Simple version
deck :: [(String, Int)]
deck =
[ (s,n)
| s <- ["Spade","Heard","Club","Diamond"]
, n <- [1..13]
]
@zemm
zemm / Makefile
Last active February 12, 2019 18:29
nix-elm-webpack project base 2019-02
SOURCES_ELM=$(shell find src -name '*.elm')
NIX_BRANCH=nixos-18.09
.PHONY: shell
shell:
nix-shell
.PHONY: format
format:
@zemm
zemm / serve.go
Last active April 22, 2021 22:54
Minimal go serve server
package main
import (
"flag"
"log"
"net/http"
)
func loggingHandler(h http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
@zemm
zemm / atom
Created November 22, 2017 09:34
Switching from atom to code
#!/bin/bash
cowstring=$(find /usr/share/cowsay -name '*.cow' -exec basename {} \; | sed 's#\.cow$##')
IFS=' ' read -r -a cowarray <<< $cowstring
cowcount=$(echo "$cowstring" | wc -w)
mycow=${cowarray[$[ ( $RANDOM % $cowcount ) + 1 ]]}
cowsay -f $mycow "Did you mean: 'code'?"
module Main exposing (..)
import Html exposing (Html)
import Html.App as App
import Time exposing (Time, second)
import Date exposing (Date)
import Date.Extra as Dx
main : Program Never
@zemm
zemm / GroupBy.elm
Last active May 18, 2016 11:58
Quick, Dirty & Naive GroupBy test hs/elm
module GroupBy exposing (..)
groupBy : List v -> (v -> k) -> List (k, List v)
groupBy items f =
case items of
[] -> []
(x::xs) ->
let key = f x
rest = groupBy xs f
in insertTo rest key x
@zemm
zemm / .gitignore
Last active May 15, 2016 17:46 — forked from datakurre/LicenseSelector.elm
Creative Commons license chooser widget in Elm
elm-stuff
@zemm
zemm / Boggle.hs
Last active October 29, 2015 22:00
Haskell Boggle
module Main where
import System.Environment
import System.IO
import Data.Char
import qualified Data.List as L
import qualified Data.Map.Strict as M
import qualified Data.Set as S
------------------------------------------
@zemm
zemm / Vagrantfile
Last active August 29, 2015 14:13
barebones multi-machine vagrant config
# -*- mode: ruby -*-
# vi: set ft=ruby :
hosts = {
"ctrl" => "192.168.101.11",
"db-1" => "192.168.101.12",
"cache-1" => "192.168.101.13",
"cache-2" => "192.168.101.14",
"web-1" => "192.168.101.15",
"web-2" => "192.168.101.16"