Skip to content

Instantly share code, notes, and snippets.

View vdayanand's full-sized avatar
🎯
Focusing

Venkatesh Dayananda vdayanand

🎯
Focusing
View GitHub Profile
@vdayanand
vdayanand / tokenmanager.jl
Created March 18, 2021 10:04
Make JuliaHub auth token available to Pkg.jl via environment variable
#=
Make JuliaHub auth token available to Pkg.jl via environment variable
Usage:
1. print encoded token: `julia -e 'include("tokenmanager.jl"); encode_token("<Absolute path of token file>")'`
2. Set PkgServer in enviroment variable `JULIA_PKG_SERVER`
3. Set the encoded token string in `JULIA_TOKEN_ENCODED`
4. Place the token in current depot: `julia -e 'include("tokenmanager.jl"); store_token()'`
=#
@vdayanand
vdayanand / UpdateRegistry.jl
Last active August 8, 2019 06:28
UpdateRegistry.jl
using Pkg, LibGit2, CredentialsHandler
function update_registry(name)
tmpdir = mktempdir()
tmpfile = joinpath(tmpdir, "tmp.tar.gz")
CredentialsHandler.download("$(ENV["JULIA_PKG_SERVER"])/$(name).tar.gz", tmpfile)
@info "Downloaded Registry tmp at ", tmpfile
dest = joinpath(Pkg.depots1(), "registries")
@static if Sys.iswindows()
run(`$(joinpath(Sys.BINDIR, "7z.exe")) x -y $(tmpfile) -o$(tmpdir) -r`)