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 command runs python modules with uvx. | |
| # Rename or make a link to this script to decide what module to run. | |
| # Example: | |
| # ln -s quick-command.sh ipython; ./ipython | |
| # If you set DOCKER=1 it will run them inside an alpine linux instance. | |
| # ln -s quick-command.sh ipython; DOCKER=1 ./ipython | |
| # Don't be shy to modify the uvx command at the bottom if you need i.e. some more libraries! |
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
| Definition plus_assoc : forall a b, a + b = b + a := | |
| nat_ind (fun n => forall b, n + b = b + n) | |
| (nat_ind (fun n => n = n + 0) eq_refl (fun n => eq_S _ _)) | |
| (fun n H b => eq_trans (eq_S _ _ (H b)) | |
| (nat_ind (fun b => S (b + n) = b + S n) | |
| eq_refl | |
| (fun _ => eq_S _ _) b) : S (n + b) = b + S n). |
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
| (* Proof that you can build foldR out of foldL *) | |
| Require Import Arith List. Import ListNotations. | |
| Fixpoint foldR {A : Type} {B : Type} (f : A -> B -> B) (v : B) (l : list A) : B := | |
| match l with | |
| | nil => v | |
| | x :: xs => f x (foldR f v xs) |
a. Boot into recovery using command-R during reboot, wipe the harddrive using Disk Utility, and select reinstall macOS
b. Initial installation will run for approximately 1 hour, and reboot once
c. It will then show a remaining time of about 10-15 minutes
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
| #include <stdio.h> | |
| #include <stdlib.h> | |
| #include <stdint.h> | |
| #ifdef _MSC_VER | |
| #include <intrin.h> /* for rdtscp and clflush */ | |
| #pragma optimize("gt",on) | |
| #else | |
| #include <x86intrin.h> /* for rdtscp and clflush */ | |
| #endif |
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
| # docker build -t coq . | |
| # coqtop() (docker run --rm -v "$HOME:$HOME" -ti coq sh -c "cd $HOME ; "'coqtop $(cat ~/src/VST/_CoqProject-export)'" $@") | |
| #FROM coqorg/coq:dev | |
| FROM coqorg/coq:8.11.0 | |
| RUN opam init -y; \ | |
| opam repo --set-default add coq-released https://coq.inria.fr/opam/released; \ | |
| opam install -y -b coq-mathcomp-algebra coq-mathcomp-analysis coq-coquelicot coq-compcert | |
TLDR:
- Export a haskell function with
foreign export. - Create a C wrapper that calls
hs_initwhen the library is loaded. - Compile the
.hsand.cwrapper withghc, linking withlHSrts-ghc8.6.5 - Use it from C by linking as usual.
(For more details, see here.)
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
| cat >demo.hs <<EOF | |
| quicksort [] = [] | |
| quicksort (p:xs) = (quicksort lesser) ++ [p] ++ (quicksort greater) | |
| where | |
| lesser = filter (< p) xs | |
| greater = filter (>= p) xs | |
| main = print(quicksort([5,2,1,0,8,3])) | |
| EOF |
NewerOlder