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 LibGit2 | |
repo_path = "LibGit2TestRepo" | |
repo_url = "[email protected]:jw3126/LibGit2TestRepo.git" | |
rm(repo_path, recursive=true, force=true) | |
mkpath(path) | |
# init | |
repo = try | |
@info "Cloning repo" |
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 ApproxFun | |
using LinearAlgebra | |
using Interact | |
using Plots | |
a = 1.; b=5. | |
Ω = a..b | |
# Ω = Chebyshev(a..b) | |
r = Fun(identity, Ω) | |
Δ_rad = 𝒟^2 + 1.0/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
using GSL | |
using Makie | |
struct Y | |
l::Int | |
m::Int | |
function Y(l,m) | |
@assert -l <= m <= l | |
new(l,m) | |
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
# install egs | |
# make tutor2pp | |
sudo apt install at | |
exb tutor2pp test1 tutor_data p=42 |
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
#!/bin/bash | |
###### tweakable parameters | |
EGS_SRC=$HOME/EGSnrc | |
CONFIG=linux.conf | |
COMPILE_USER_CODES=1 | |
###### script implemention | |
export HEN_HOUSE=$EGS_SRC/HEN_HOUSE | |
export EGS_CONFIG=$HEN_HOUSE/specs/linux.conf |
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
# https://math.stackexchange.com/questions/1049788/haar-measure-of-an-angle-distance-ball-in-so3 | |
using StatsBase | |
using LinearAlgebra | |
using StatPlots | |
using Plots | |
using Rotations | |
function sample_angles(N) | |
map(1:N) do _ |
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 LinearAlgebra | |
function linreg(xs, ys) | |
# Axs + b ≈ ys | |
@assert size(xs,2) == size(ys,2) | |
nobs = size(xs, 2) | |
xs_ = [xs; transpose(ones(nobs))] | |
ys_ = [ys; transpose(ones(nobs))] | |
A_ = ys_ / xs_ | |
@assert A_[end, end] ≈ 1 |
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 Unitful | |
using Unitful: MeV, NoUnits, cm | |
using UnitfulRecipes | |
const h = 6.626_070_040e-34*u"J*s" | |
const h_bar = h / (2pi) | |
const m_e = 9.10938356e-31 * u"kg" | |
const c = 299_792_458.0 * u"m/s" | |
const r_c = h_bar / (c*m_e) # reduced compton wavelength of electron |
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
#[derive(Debug)] | |
struct MyString { | |
s:String, | |
} | |
impl MyString { | |
fn to_str(&self) -> &str { | |
&self.s | |
} |
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
use std::path::{Path}; | |
fn create_path<'a>(s: &'a String)->&'a Path { // return value has the same lifetime as input | |
Path::new(s) | |
} | |
fn main() { | |
let s = "some/path".to_string(); | |
let p = create_path(&s); |