Suppose there is a commit C
which have a single parent commit P
.
Let's say that TC
and TP
are the corresponding tree objects.
Why git diff P C
is not always equal to git diff-tree TP TC -p
?
target hw1 | |
sources | |
hw1.mlb | |
hw1.main.sml | |
end | |
option compiler = mlton | |
option output = hw1 | |
end |
Various blog posts related to Nix and NixOS
configuration.nix
example.instance FromJSON Database where | |
- parseJSON (Object o) = Database | |
- <$> o .: "id" | |
- <*> o .: "_rid" | |
- <*> o .: "_ts" | |
- <*> o .: "_self" | |
- <*> o .: "_etag" | |
- <*> o .: "_colls" | |
- <*> o .: "_users" | |
+ parseJSON (Object o) = |
#!/bin/bash | |
# wow so bash such fast very O(n^2*log(n)^2) | |
for author in `git log --format='%ae' | sort -u`; do | |
changes=`git log --author=$author --pretty=tformat: --numstat | awk '{ add += $1 ; subs += $2 } END { printf "%s ++ / %s --\n",add,subs }'` | |
commits=`git log --author=$author --oneline | wc -l` | |
echo "$author: $commits commits / $changes" | |
done | sort -rn -k2 |
open System | |
open System.Net | |
type Stock(symbol : string) = class | |
let url = | |
"http://download.finance.yahoo.com/d/quotes.csv?s=" + symbol + "&f=sl1d1t1c1ohgv&e=.csv" | |
let mutable _symbol = String.Empty | |
let mutable _current = 0.0 | |
let mutable _open = 0.0 |
What is going on here is creating 2 streams with numbers from 1 to 100000 sorting randomly and finding with grep all lines that each of them contains. All of them, actually. -c flag is a shortcut for `| wc -l`, nothng more. | |
$> n=100000; time grep -f <(seq 1 $n | sort -R) <(seq 1 $n | sort -R) -c | |
100000 | |
grep -f <(seq 1 $n | sort -R) <(seq 1 $n | sort -R) -c 148.65s user 0.28s system 98% cpu 2:31.89 total | |
$> n=100000; time grep -xF -f <(seq 1 $n | sort -R) <(seq 1 $n | sort -R) -c | |
100000 | |
grep -xF -f <(seq 1 $n | sort -R) <(seq 1 $n | sort -R) -c 0.34s user 0.01s system 26% cpu 1.315 total |
import Control.Monad (($), forM, undefined) | |
main = forM [] $ undefined |
Lemma mult_0_r : forall n:nat, | |
n * 0 = 0. | |
Proof. | |
intros n. induction n as [| n']. | |
(* Case "n = 0". *) | |
simpl. | |
reflexivity. | |
(* Case "n = S n'". *) | |
simpl. | |
rewrite -> IHn'. |
α(L,P,R) :- β(L,P,R,0). | |
β([H|T],P,R,A) :- pow(H,P,X), β(T,P,R,A + X). | |
β([H],P,R,A) :- pow(H,P,X), R is A + X. | |
γ(X, Y, P) :- α(X, P, A), α(Y, P, B), A == B, !. | |
main(A) :- findall(X, (between(0,100,X), γ([0,3,5,6,9,10,12,15], [1,2,4,7,8,11,13,14], X)), A). |