Skip to content

Instantly share code, notes, and snippets.

View jmackie's full-sized avatar
🕺

Jordan Mackie jmackie

🕺
View GitHub Profile
@nitrocode
nitrocode / github-gpg-key-with-private-email.md
Last active April 4, 2024 21:43
Github "Verified" commits using GPG key with private email

Github "Verified" commits using GPG key with private email

It's nice to see a Verified message next to each commit for peace of mind.

Using GPG or S/MIME, you can sign tags and commits locally. These tags or commits are marked as verified on GitHub so other people can be confident that the changes come from a trusted source.

  1. Install latest gpg

    If using a mac use homebrew

@chrisdone
chrisdone / Intro.md
Last active April 10, 2023 06:33
Statically checked overloaded strings

Statically checked overloaded strings

This gist demonstrates a trick I came up with which is defining IsString for Q (TExp a), where a is lift-able. This allows you to write $$("...") and have the string parsed at compile-time.

On GHC 9, you are able to write $$"..." instead.

This offers a light-weight way to enforce compile-time constraints. It's basically OverloadedStrings with static checks. The inferred return type

@i-am-tom
i-am-tom / Main.hs
Last active June 27, 2019 14:07
Using Higgledy to create parser fallbacks.
{-# LANGUAGE BlockArguments #-}
{-# LANGUAGE DeriveFunctor #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE MonoLocalBinds #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE TypeApplications #-}
module Main where
import Control.Applicative (Alternative (..))
@kamilchm
kamilchm / shell.nix
Created September 17, 2018 12:06
React Native nix-shell
with import <nixpkgs> {};
let
jdk = openjdk;
node = nodejs-10_x;
sdk = androidenv.androidsdk {
platformVersions = [ "23" ];
abiVersions = [ "x86" ];
useGoogleAPIs = true;
useExtraSupportLibs = false;
--Roughly based on https://github.com/Gabriel439/Haskell-Morte-Library/blob/master/src/Morte/Core.hs by Gabriel Gonzalez et al.
data Expr = Star | Box | Var Int | Lam Int Expr Expr | Pi Int Expr Expr | App Expr Expr deriving (Show, Eq)
subst v e (Var v') | v == v' = e
subst v e (Lam v' ta b ) | v == v' = Lam v' (subst v e ta) b
subst v e (Lam v' ta b ) = Lam v' (subst v e ta) (subst v e b )
subst v e (Pi v' ta tb) | v == v' = Pi v' (subst v e ta) tb
subst v e (Pi v' ta tb) = Pi v' (subst v e ta) (subst v e tb)
subst v e (App f a ) = App (subst v e f ) (subst v e a )
@flbuddymooreiv
flbuddymooreiv / readme.md
Last active February 6, 2024 22:31
erlang + rebar + cowboy Hello World

This is the process of setting up erlang, rebar3, and cowboy for a Hello World, starting with a clean Debian 8 install.

Update apt and install deps:

root@046edcaea45a:~# apt-get update
root@046edcaea45a:~# apt-get install erlang erlang-dev gcc
root@046edcaea45a:~# wget https://s3.amazonaws.com/rebar3/rebar3
root@046edcaea45a:~# mkdir ~/bin/
root@046edcaea45a:~# mv rebar3 ~/bin/
root@046edcaea45a:~# chmod +x ~/bin/rebar3 
@travisbhartwell
travisbhartwell / nix-shell-shebang.md
Last active March 29, 2024 19:55
nix-shell and Shebang Lines

NOTE: a more up-to-date version of this can be found on my blog

nix-shell and Shebang Lines

A few days ago, version 1.9 of the Nix package manager was released. From the release notes:

nix-shell can now be used as a #!-interpreter. This allows you to write scripts that dynamically fetch their own dependencies.

@stlehmann
stlehmann / setup.py
Created January 13, 2015 12:45
py2exe setup script for PyQt5 application including matplotlib, numpy, scipy, pandas
#! python3.4
from setuptools import setup
import os
import py2exe
import matplotlib
includes = ["sip",
"PyQt5",
"PyQt5.QtCore",
"PyQt5.QtGui",
@mandiwise
mandiwise / Count lines in Git repo
Last active May 5, 2024 21:37
A command to calculate lines of code in all tracked files in a Git repo
// Reference: http://stackoverflow.com/questions/4822471/count-number-of-lines-in-a-git-repository
$ git ls-files | xargs wc -l
@dergachev
dergachev / docker.mk
Last active September 19, 2017 09:14
Useful Makefile snippets for docker usage
name=coursecal-d7
port=$(shell docker inspect -format='{{(index (index .NetworkSettings.Ports "22/tcp") 0).HostPort}}' $(name))
# launches a debug shell into the latest intermediate docker image
debug_latest:
docker run -t -i `docker images -q | head -n 1` /bin/bash
# DESTROYS all containers (!!) and all images without a tag
# NB: