Skip to content

Instantly share code, notes, and snippets.

View dmalikov's full-sized avatar
🥞
!

Dmitry Malikov dmalikov

🥞
!
View GitHub Profile
@dmalikov
dmalikov / README.md
Created July 15, 2024 22:59
remove HR from garmin activity

Remove HR from TCX file

Requirements

stack is required. On MacOS it can be installed via brew install stack.

Usage

Assuming there is an affected Garmin activity that you want to remove HR data from.

@dmalikov
dmalikov / diffsdiff.md
Created April 30, 2015 15:06
`git-diff` != `git-diff-tree`?

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?


Why they should be equal?

@dmalikov
dmalikov / build.sm
Last active May 17, 2020 20:23
Programming Languages assignment 1 (with smbt and qcheck)
target hw1
sources
hw1.mlb
hw1.main.sml
end
option compiler = mlton
option output = hw1
end
@dmalikov
dmalikov / README.markdown
Last active May 31, 2019 06:31
Nix / NixOS links

Various blog posts related to Nix and NixOS


General

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) =
@dmalikov
dmalikov / git-contributors.sh
Created January 28, 2014 20:52
analogue of github contributors stats
#!/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
@dmalikov
dmalikov / wut.fs
Created September 24, 2013 21:03
nice constructor syntax
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
@dmalikov
dmalikov / blewotah.sh
Created August 12, 2013 20:17
unsorted stream intersection with grep, -xF magician
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
@dmalikov
dmalikov / after.hs
Created July 28, 2013 13:20
nice module-management package
import Control.Monad (($), forM, undefined)
main = forM [] $ undefined
@dmalikov
dmalikov / commutative.v
Created April 17, 2013 21:42
m * n = n * m
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'.