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
sudo apt install cmake libfftw3-dev qtbase5-dev qttools5-dev libusb-1.0-0-dev | |
git clone https://github.com/OpenHantek/OpenHantek6022 | |
cd OpenHantek6022 | |
mkdir build | |
cd build | |
cmake .. | |
make | |
sudo cp ../utils/udev_rules/60-openhantek.rules /etc/udev/rules.d/ |
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
python -m venv OctoPrint | |
OctoPrint/bin/pip install OctoPrint | |
wget https://github.com/OctoPrint/OctoPrint/raw/master/scripts/octoprint.service | |
emacs octoprint.service | |
sudo mv octoprint.service /etc/systemd/system/octoprint.service | |
sudo systemctl enable octoprint.service | |
sudo service octoprint start |
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
open Printf | |
type expr = | |
| Int of int | |
| Var of string | |
| Add of expr * expr | |
| Mul of expr * expr | |
| Pow of expr * expr | |
| Ln of expr |
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
enum Expr { | |
case Int(n: Int) | |
case Var(x: String) | |
indirect case Add(f: Expr, g: Expr) | |
indirect case Mul(f: Expr, g: Expr) | |
indirect case Pow(f: Expr, g: Expr) | |
indirect case Ln(f: Expr) | |
} | |
func pown(a: Int, b: Int) -> Int { |
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
type Term = | |
| Var of int | |
| Pair of Term * Term | |
| Int of int | |
let (|Find|_|) s k = Map.tryFind k s | |
let rec walk (s: Map<_,_>) = function | |
| Var(Find s t) -> walk s t | |
| t -> t |
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
type Json = | |
| Null | |
| Bool of bool | |
| Number of float | |
| String of string | |
| Array of Json list | |
| Object of (string * Json) list | |
type Bracket = Open | Close |
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
let g = 0.02 and k = 500 and t = 1500 | |
let evolve(r, f) = | |
let dtrf = 0.0001 * r * f in | |
Some((r, f), (r + (1.0 - r/k)*r*g - dtrf, dtrf + (1.0 - g)*f)) | |
let () = | |
Seq.unfold evolve (50, 10) | |
@ Seq.truncate 1500 | |
@ Array.ofSeq |
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
let search p = | |
let m = # p in | |
let next = Array.init m [_ -> 0] in | |
let rec init(i, j) = | |
if i >= m-1 then () else | |
if Array.get p i = Array.get p j then | |
let () = Array.Unsafe.set next (i+1) (j+1) in | |
init(i+1, j+1) | |
else | |
if j=0 then init(i+1, j) else init(i, Array.get next j) in |
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
type State = | |
| S0 | |
| S1 Number | |
| S2 Number | |
let charOfNumber n = | |
if n<26 then Char.ofNumber(n+65) | |
else if n<52 then Char.ofNumber(n-26+97) | |
else if n<62 then Char.ofNumber(n-52+48) | |
else if n=62 then '+' else '/' |
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
let suffixArray str = | |
let g = Array.get in | |
let n = # str in | |
let sa = Array.init n id in | |
let pos = Array.copy str in | |
let tmp = Array.init n [_ -> 0] in | |
let sufCmp gap (i, j) = | |
compare (g pos i, g pos j) @ | |
[ Equal -> | |
if i+gap >= n || j+gap >= n then compare(j, i) else |
NewerOlder