Skip to content

Instantly share code, notes, and snippets.

View avh4's full-sized avatar

Aaron VonderHaar avh4

View GitHub Profile
@avh4
avh4 / string-conversions.hs
Created February 17, 2021 19:36 — forked from dino-/string-conversions.hs
A handy illustration of converting between String, Text and ByteString in Haskell
#! /usr/bin/env stack
-- stack --resolver lts-12.14 script
{-# LANGUAGE OverloadedStrings #-}
{-
This is a handy illustration of converting between five of the commonly-used
string types in Haskell (String, ByteString, lazy ByteString, Text and lazy
Text).
@avh4
avh4 / Duckling.elm
Created December 12, 2020 22:29
Infinite ducklings
module Duckling exposing (main)
{-| This demo loads a convex shape and a mesh from the same OBJ file.
- elm-physics is used for simulation
- elm-3d-scene is used for rendering
It is important to keep the convex shape as small as possible, because
this affects the simulation performance.
@avh4
avh4 / CountOpenSafariTabs.scpt
Created October 31, 2020 19:28 — forked from edenwaith/CountOpenSafariTabs.scpt
AppleScript: Count the number of open tabs in Safari
-- CountOpenSafariTabs.scpt
-- Author: Chad Armstrong
-- Date: 13 May 2016
-- Description: Count the number of open tabs in Safari
-- To run from CLI: osascript CountOpenSafariTabs.scpt
tell application "Safari"
--Variables
set winlist to every window
@avh4
avh4 / Wireframe.elm
Created April 25, 2020 03:29
elm-ui wireframe
module Main exposing (main)
import Element exposing (..)
import Element.Background as Background
import Element.Border as Border
import Element.Font as Font
main =
layout [] <|
@avh4
avh4 / set_up_diffmerge.sh
Created April 27, 2012 16:58
Git mergetool configurations
# Download diffmerge from http://www.sourcegear.com/diffmerge/
git config --global merge.tool diffmerge
git config --global mergetool.diffmerge.cmd "diffmerge --merge --result=\$MERGED \$LOCAL \$BASE \$REMOTE"
git config --global mergetool.diffmerge.trustExitCode true
git config --global mergetool.keepBackup false
git config --global diff.tool diffmerge
git config --global difftool.diffmerge.cmd "diffmerge \$LOCAL \$REMOTE"
@avh4
avh4 / main.hs
Last active December 21, 2019 19:10
Haskell type params subset
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeFamilyDependencies #-}
{-# LANGUAGE AllowAmbiguousTypes #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE UndecidableInstances #-}
{-# LANGUAGE Rank2Types #-}
data Never
@avh4
avh4 / main.hs
Last active October 23, 2019 19:43
Haskell AST types
{-# LANGUAGE UndecidableInstances #-}
{-# LANGUAGE TypeSynonymInstances #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE Rank2Types #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE FlexibleInstances #-}
import Data.Functor.Identity (Identity(..))
import Html
import Html.Events
import Json.Decode
onClickPreventDefaultForLinkWithHref : msg -> Html.Attribute msg
onClickPreventDefaultForLinkWithHref msg =
let
isSpecialClick : Json.Decode.Decoder Bool
isSpecialClick =
Json.Decode.map2
@avh4
avh4 / btsync.sh
Created October 30, 2013 04:51
startup script for running BitTorrent Sync on Synology NAS
#!/bin/sh
#
# Put this file in /usr/local/etc/rc.d/btsync.sh
case "$1" in
stop)
echo "Stop BitTorrent Sync..."
kill "`cat /volume1/homes/btsync/bin/.sync/sync.pid`"
kill "`cat /volume1/homes/btsync/bin/.sync/sync.pid`"
#!/bin/bash
set -e
git fetch
CURRENT="$(git rev-parse --abbrev-ref HEAD)"
# find where the current branch branched from origin/master
REFERENCE="origin/master"