This file contains 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
# Guiding principle: a shell is a domain-specific language for handling | |
# files and processes. These core features shall be served by a dedicated | |
# and already familiar syntax. Traditional programming control structures | |
# on the other hand are hard to use and limited in traditional shell | |
# languages. For this, we shall use a proper programming language, one that | |
# checks statically for basic programming mistakes, allows the use of rich | |
# data structures, and integrates well in large applications. | |
# | |
# Language properties: | |
# |
This file contains 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
(* Generated by ocaml-tree-sitter. *) | |
(* | |
typescript grammar | |
entrypoint: program | |
*) | |
open! Sexplib.Conv | |
open Tree_sitter_run |
This file contains 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
(** | |
Boilerplate to be used as a template when mapping the java CST | |
to another type of tree. | |
*) | |
(* Disable warnings against unused variables *) | |
[@@@warning "-26-27"] | |
(* Disable warning against unused 'rec' *) | |
[@@@warning "-39"] |
This file contains 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
(** | |
Boilerplate to be used as a template when mapping the java CST | |
to another type of tree. | |
*) | |
(* Disable warnings against unused variables *) | |
[@@@warning "-26-27"] | |
(* Disable warning against unused 'rec' *) | |
[@@@warning "-39"] |
This file contains 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
# Bash function | |
# | |
# Usage: save foo.bar | |
# - creates a file like foo.bar.d41d8cd, | |
# - overwrites previous copy if identical, | |
# - preserves other previous versions with very high probability | |
# | |
save() { | |
file=$1 | |
if [[ -f "$file" ]]; then |
This file contains 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
(* | |
Sample command-line argument specified using Cmdliner's author's style. | |
*) | |
open Cmdliner | |
let seed_term = | |
let doc = " | |
Use the number $(docv) to initialize the global pseudo-random number | |
generator. |
This file contains 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
git_stash_size() { | |
n=$( (git stash list 2> /dev/null || :) | wc -l ) | |
if [ $n -gt 0 ]; then | |
echo -n " +$n" | |
fi | |
} | |
git_branch() { | |
echo -n "$(git branch 2> /dev/null \ | |
| sed -e '/^[^*]/d' -e 's/* \(.*\)/ \[\1\]/')" |
This file contains 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/bash | |
# | |
# Illustrate what happens when editing a script while it's running. | |
# | |
# This happens when saving the file in emacs, for example, but not with | |
# 'sed -i' because the latter deletes the old file before writing a new one. | |
# See https://unix.stackexchange.com/a/88572/46435 for an explanation. | |
# | |
set -eu |
This file contains 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/bash | |
x=1 | |
f() { | |
echo "$x" | |
} | |
g() { | |
local x=2 |
This file contains 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/bash | |
f() { | |
echo "$x" | |
} | |
main() { | |
local x=42 | |
f | |
} |