This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# | |
# This script sets up git similar to the git bridge of Overleaf. It is based on | |
# instructions by Tobias Bora (https://github.com/sagemathinc/cocalc/issues/3811#issuecomment-493138304). | |
# If the repository and git hooks do not exist, they are created. | |
# If they do exist, then this script tells you about config conflicts and how to | |
# resolve them. | |
# | |
# | |
# Usage: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
with builtins; | |
let | |
printChild = prefix: x: | |
let | |
names = attrNames x; | |
in | |
if isAttrs x && length names == 1 | |
then "." + head names + printChild prefix x.${head names} | |
else " = " + print prefix x | |
; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE ConstraintKinds #-} | |
{-# LANGUAGE DataKinds #-} | |
{-# LANGUAGE FlexibleContexts #-} | |
{-# LANGUAGE FlexibleInstances #-} | |
{-# LANGUAGE GADTs #-} | |
{-# LANGUAGE GeneralizedNewtypeDeriving #-} | |
{-# LANGUAGE MultiParamTypeClasses #-} | |
{-# LANGUAGE OverloadedStrings #-} | |
{-# LANGUAGE PolyKinds #-} | |
{-# LANGUAGE Rank2Types #-} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
pname="$(basename "$0")" | |
read -d '' usage <<EOF | |
Usage: $pname -h|--help | |
$pname [-n <number of context lines>] [attrset (default: nixpkgs)] <attr name> | |
EOF | |
attrset="import <nixpkgs> {}" | |
n=3 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
self="$(basename "$0")" | |
warn() { | |
# !!! WARNING: don't ever feed user-supplied args into this function !!! | |
fmt="${1%\\n}\\n" | |
shift | |
# disable warning about variables in format string | |
# shellcheck disable=SC2059 |