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
| Pkg.clone("https://github.com/cossio/Utils.jl") | |
| Pkg.clone("https://github.com/cossio/COBRAUtils.jl") | |
| Pkg.clone("https://github.com/cossio/TruncatedNormal.jl") |
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 zsh | |
| submodules=("${(@f)$(find . -type d -depth 1)}") | |
| for submodule in $submodules | |
| do | |
| print "=== $submodule" | |
| git --work-tree=$submodule --git-dir=$submodule/.git $* | |
| done |
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
| ENV["JULIA_EDITOR"] = "vim -R" |
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
| pdfimages -j input.pdf output |
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
| "A tensor of zeros" | |
| struct ZeroTensor{T <: Number, N} <: AbstractArray{T,N} | |
| dims::NTuple{N,Int} | |
| function ZeroTensor{T,N}(dims::Vararg{Integer,N}) where {T <: Number, N} | |
| all(dims .≥ 0) || error("invalid ZeroTensor dimensions") | |
| new(dims) | |
| end | |
| end | |
| ZeroTensor(T::DataType, dims::Vararg{Integer,N}) where N = ZeroTensor{T,N}(dims...) | |
| ZeroTensor(dims::Vararg{Integer,N}) where {N} = ZeroTensor{Float64,N}(dims...) |
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
| function fib(n::Integer) | |
| @assert n ≥ 0 | |
| if iszero(n) | |
| return zero(n) | |
| elseif n == 1 || n == 2 | |
| return one(n) | |
| end | |
| k = div(n,2) | |
| if iseven(n) | |
| return fib(k) * (2fib(k+1) - fib(k)) |
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
| function dnacompl(nt::Char) | |
| @assert nt ∈ ('A', 'T', 'C', 'G', 'N', '*') | |
| if nt == 'A' | |
| return 'T' | |
| elseif nt == 'T' | |
| return 'A' | |
| elseif nt == 'G' | |
| return 'C' | |
| elseif nt == 'C' | |
| return 'G' |
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
| for i = 1:L, a = 1:A | |
| @assert sub2ind((A,L),a,i) == (i-1)*A + a | |
| end | |
| for j=1:L, i=1:L, b=1:A, a=1:A | |
| @assert sub2ind((A,A,L,L),a,b,i,j) == a + (b-1)*A + (i-1)*A*A + (j-1)*A*A*L | |
| end | |
| srand(2); | |
| L = rand(2:10); A = rand(2:10,L); |
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
| function findmaxkey(d::Dict) | |
| maxk,maxv = first(d) | |
| for k in keys(d) | |
| if d[k] > maxv | |
| maxk, maxv = k, d[k] | |
| end | |
| end | |
| return maxk=>maxv | |
| end |
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
| using Distributions | |
| n = 4969027388018185 | |
| p = [4.471459552709845e-5, | |
| 0.0021070048390116223, | |
| 0.0017485819413324416, | |
| 0.0022622153482103544, | |
| 0.0019479678673445784, | |
| 0.0015864519243622935, | |
| 0.00037279832670023585, |