Skip to content

Instantly share code, notes, and snippets.

View steshaw's full-sized avatar
👨‍💻
Loves programming languages

Steven Shaw steshaw

👨‍💻
Loves programming languages
View GitHub Profile
@MonoidMusician
MonoidMusician / 0. TT Intro.md
Last active July 24, 2020 05:53
(Homotopy) Type Theory Musings, informal and intuitive (hopefully)

MonoidMusicianʼs Type Theory Musings

Welcome to my (un)scrambled thoughts on all things from the intersection of homotopy type theory, functional programming, and set theory! Thereʼs going to be a lot of terminology being thrown around, but donʼt be intimidated: hopefully Iʼll either describe the term, link to a definition/explanation, or youʼll be able to figure it out from context (or just skip it!). I do believe the best way to be clear is to be precise with language and to use established terminology, but because I am synthesizing pretty disparate areas of knowledge, most people wonʼt know all the terms.

My goal with these are to raise some new perspectives on common themes, and cross-pollinate these fields with each other.

# Usage: $ nix eval "(builtins.attrNames (import (builtins.fetchurl "https://matthewbauer.us/generate-versions.nix") {}).emacs)"
# $ nix run "(import (builtins.fetchurl "https://matthewbauer.us/generate-versions.nix") {}).emacs.\"24.3\"" -u LANG -c emacs
{ channels ? [ "19.03" "18.09" "18.03" "17.09" "17.03"
"16.09" "16.03" "15.09" "14.12" "14.04" "13.10" ]
, attrs ? builtins.attrNames (import <nixpkgs> {})
, system ? builtins.currentSystem
, args ? { inherit system; }
}: let
getSet = channel: (import (builtins.fetchTarball "channel:nixos-${channel}") args).pkgs;
@rbreaves
rbreaves / macOS keyboard layout for Linux
Last active March 31, 2024 10:35
Universal macOS keyboard layout for Linux - Applies to All Windows and Apple Keyboards
# permanent apple keyboard keyswap
echo "options hid_apple swap_opt_cmd=1" | sudo tee -a /etc/modprobe.d/hid_apple.conf
update-initramfs -u -k all
# Temporary & instant apple keyboard keyswap
echo '1' | sudo tee -a /sys/module/hid_apple/parameters/swap_opt_cmd
# Windows and Mac keyboards - GUI (Physical Alt is Ctrl, Physical Super is Alt, Physical Ctrl is Super)
setxkbmap -option;setxkbmap -option altwin:ctrl_alt_win
@colomboe
colomboe / fx-test.kt
Created July 4, 2019 19:25
Porting of "Simple example of testing with ZIO environment" to Kotlin
// Porting of https://gist.github.com/jdegoes/dd66656382247dc5b7228fb0f2cb97c8
typealias UserID = String
data class UserProfile(val name: String)
// The database module:
interface DatabaseService {
suspend fun dbLookup(id: UserID): UserProfile
suspend fun dbUpdate(id: UserID, profile: UserProfile)
}
@Widdershin
Widdershin / nick.nix
Created May 30, 2019 04:35
My overlay
self: super:
{
# Install overlay:
# $ mkdir -p ~/.config/nixpkgs/overlays
# $ curl https://gist.githubusercontent.com/LnL7/570349866bb69467d0caf5cb175faa74/raw/3f3d53fe8e8713ee321ee894ecf76edbcb0b3711/lnl-overlay.nix -o ~/.config/nixpkgs/overlays/lnl.nix
userPackages = super.userPackages or {} // {
self.config.allowUnfree = true;
self.config.allowUnsupportedSystem = true;
@jakedohm
jakedohm / gridsome.server.js
Last active April 24, 2020 20:42
Gridsome (0.6) + Craft CMS Integration
// Server API makes it possible to hook into various parts of Gridsome
// on server-side and add custom data to the GraphQL data layer.
// Learn more: https://gridsome.org/docs/server-api
// Changes here requires a server restart.
// To restart press CTRL + C in terminal and run `gridsome develop`
const { setContext } = require('apollo-link-context')
const { HttpLink } = require('apollo-link-http')
const {
@elizarov
elizarov / AD.kt
Last active September 5, 2024 00:32
Automatic Differentiation with Kotlin
/*
* Implementation of backward-mode automatic differentiation.
*/
/**
* Differentiable variable with value and derivative of differentiation ([grad]) result
* with respect to this variable.
*/
data class D(var x: Double, var d: Double = 0.0) {
constructor(x: Int): this(x.toDouble())
@dubiouscript
dubiouscript / snip.sh
Last active July 10, 2020 01:34 — forked from mgoellnitz/snip.sh
GitLab Snippet Command Line Tool
#!/bin/bash
#
# Copyright 2016-2017 Martin Goellnitz
#
# update gitlab api
# https://gist.github.com/dubiouscript/5553dce89497ffd9805dd0de16503e8d
# -dscript-
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@elizarov
elizarov / Delimited.kt
Last active October 27, 2024 23:38
Delimited Continuations shift/reset in Kotlin
import kotlin.coroutines.*
import kotlin.coroutines.intrinsics.*
/**
* Implementation for Delimited Continuations `shift`/`reset` primitives via Kotlin Coroutines.
* See [https://en.wikipedia.org/wiki/Delimited_continuation].
*
* The following LISP code:
*
* ```
@gelisam
gelisam / EIO.hs
Last active February 10, 2022 05:21
Keeping track of which exceptions have and haven't been handled
-- a continuation of https://gist.github.com/gelisam/137effb33d2777328d366dcb563d8d13
{-# LANGUAGE FlexibleContexts, FlexibleInstances, GeneralizedNewtypeDeriving, LambdaCase, MultiParamTypeClasses #-}
module EIO where
import Control.Monad
import Data.Void
import Test.DocTest
import qualified Control.Exception as E