Skip to content

Instantly share code, notes, and snippets.

View TomMD's full-sized avatar

Thomas M. DuBuisson TomMD

View GitHub Profile
@TomMD
TomMD / gist:0d950753d13a33864e56d26217fec8d7
Created July 23, 2023 15:02
Basic shell.nix useful for some Haskell dev work
let
unstable = import <nixos-unstable> {};
new = import <nixos-21.11> {};
in new.mkShell {
buildInputs = [
new.ghc
new.haskellPackages.haskell-language-server
unstable.neovim
new.zlib.dev
# unstable.terraform
#!/usr/bin/env bash
function emit_results() {
results=$1
echo $results | \
jq '[ .[] |
select (.vulns != null) |
.vulns |
.[] |
.type = .id |
#!/bin/bash
# This script conforms to the Lift Script API v1
declare -a patterns
patterns=(XXX TODO FIXME)
directory=$1
commit=$2
command=$3
@TomMD
TomMD / psalm.sh
Last active September 23, 2021 19:09
Psalm Integration to Lift
#!/usr/bin/env bash
PSALM=/tmp/psalm.phar
SUDO=
if [[ -x $(command -v sudo) ]] ; then
SUDO=sudo
fi
# Psalm isn't part of the Lift tooling. Install it.
function install_psalm() {
@TomMD
TomMD / common.sh
Last active August 12, 2020 17:20
#!/bin/bash
# This script conforms to the Muse Script API v1, providing
# a 'version', 'applicable <path>', and 'run <path>` operation.
declare -a patterns
patterns=(XXX TODO FIXME)
directory=$1
commit=$2
@TomMD
TomMD / Marbles.hs
Last active January 2, 2022 17:39
Marbles Solver using Gloss in Haskell
#!/usr/bin/env cabal
{- cabal:
build-depends: base, gloss
-}
{-# LANGUAGE BinaryLiterals #-}
import Prelude hiding (Either(..))
import Data.Word (Word64)
import Data.List (nub)
import Data.Maybe (catMaybes)
import Data.Bits (testBit,setBit,clearBit,shiftR,popCount)
@TomMD
TomMD / zeromq-secure-example.hs
Created September 24, 2018 16:01
Example ZeroMQ Haskell
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ViewPatterns #-}
import Control.Applicative
import Control.Monad
import Control.Concurrent
import Control.Exception as X
import Data.Traversable
import Data.Monoid
import Data.String
import Data.Foldable
@TomMD
TomMD / Using memset_s
Created August 14, 2017 15:57
Using memset_s
tommd@HalfAndHalf /tmp% cat dw.c
#define __STDC_WANT_LIB_EXT1__ 1
#include <string.h>
int main()
{
unsigned char data[10];
memset_s(data,10,0,10);
return 0;
}
@TomMD
TomMD / TheFile.lhs
Created August 9, 2017 04:45
GHC Stack on `error` with ghc 8.2
I was told compiling with `prof` will make the new GHC call stacks more informative (which seems odd) so I made this test.
Consider `so.hs`:
> import GHC.Stack
>
> main :: IO ()
> main = f
>
> f, g, h :: IO ()

Keybase proof

I hereby claim:

  • I am tommd on github.
  • I am tommd (https://keybase.io/tommd) on keybase.
  • I have a public key whose fingerprint is 6E35 2C85 514C 080E 745D 10F8 1C09 217D A7A7 8EF5

To claim this, I am signing this object: