Skip to content

Instantly share code, notes, and snippets.

View jhburns's full-sized avatar

Jonathan Burns jhburns

View GitHub Profile
@jhburns
jhburns / scope.hs
Created November 18, 2023 05:33
Minimal scoping pass that uniquely renames variables and supports shadowing
import qualified Data.Map as Map
import qualified Control.Monad.State as State
data NamedExpr =
NamedLet String Int | -- let x = 1
NamedBlock NamedStatements | -- { ... }
NamedPrint String -- print(x)
type NamedStatements = [NamedExpr]
@jhburns
jhburns / razz_lang.hs
Last active April 29, 2024 18:48
Small RPN calculator
-- razz_lang
import Data.Function
import Data.Semigroup
import qualified Data.List as List
import qualified Data.Map as Map
import qualified Text.Read as Read
-- Stack types
// A minimal reimplementation if mizzle's typechecker in CSharp
// https://github.com/jhburns/mizzle/blob/master/src/type_check.rs
using System;
using System.Collections.Generic;
using System.Linq;
// Whats the point of this type?
// For use in other generic types, like say `Result<Unit, string>` or `Outcome<Unit>`
public struct Unit {}
#!/usr/bin/env bash
while read -rep "Enter input path location: " in_dir; do
if [ -d "${in_dir}" ]; then
echo "${in_dir} already exists - please enter a valid directory path."
else
break
fi
done

SSH Forwarding

The purpose of this guide is to show how to authenticate to GitHub while sshing into another computer.

Steps

  1. Follow this guide locally, verify that you can authenticate to GitHub normally.
  2. Add a file config to ~/.ssh/ and save the following content to it:
Host icd.chapman.edu
@jhburns
jhburns / jcar.fish
Created September 10, 2019 02:59
Should go in ~/.config/fish/functions
function jcar
javac $argv.java -d built; java -cp built/ $argv
end

Chapman VPN Setup Debian

Make sure to replace anything in square brackets, [], with your values and remove the brackets.

Install

Run sudo apt install pptp-linux, and select 'Y' (press enter) at the prompt. This tutorial is using version 1.9.0 of pptp and release 18.04 of Ubuntu.

Check Config

{ config, pkgs, ... }:
{
imports = [ <nixpkgs/nixos/modules/installer/virtualbox-demo.nix>
];
programs.fish.enable = true;
environment.systemPackages = [
{ config, pkgs, ... }:
{
imports = [ <nixpkgs/nixos/modules/installer/virtualbox-demo.nix>
];
programs.fish.enable = true;
users.extraUsers.demo = {
version: '2'
services:
portainer:
image: portainer/portainer
ports:
- "9000:9000"
command: -H unix:///var/run/docker.sock
volumes:
- /var/run/docker.sock:/var/run/docker.sock