Skip to content

Instantly share code, notes, and snippets.

Morten Piibeleht mortenpi

  • Massey University
  • Auckland, New Zealand
Block or report user

Report or block mortenpi

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@mortenpi
mortenpi / canonical-urls.diff
Last active Aug 22, 2018
gh-pages vs. gh-pages-update-to-v1
View canonical-urls.diff
diff -r -U1 v1.0.0-original/base/arrays/index.html v1.0.0/base/arrays/index.html
--- v1.0.0-original/base/arrays/index.html 2018-08-23 08:50:28.282999201 +1200
+++ v1.0.0/base/arrays/index.html 2018-08-23 08:50:27.483004523 +1200
@@ -20,3 +20,3 @@
<link rel="canonical" href=
-"https://docs.julialang.org/en/stable/base/arrays/index.html">
+"https://docs.julialang.org/en/v1/base/arrays/index.html">
<link href=
diff -r -U1 v1.0.0-original/base/base/index.html v1.0.0/base/base/index.html
--- v1.0.0-original/base/base/index.html 2018-08-23 08:50:28.378998563 +1200
View pycall-debug-build.log
julia> ENV["PYCALL_DEBUG_BUILD"]="yes"
"yes"
(pycall-523) pkg> build PyCall
Building Conda ─→ `~/.julia/packages/Conda/m7vem/deps/build.log`
Building PyCall → `dev/PyCall/deps/build.log`
Resolving package versions...
┌ Error: Error building `PyCall`:
│ ------------------------------------- exceptions -----------------------------------------
│ ---------------------------------- get_config_vars ---------------------------------------
View Manifest.toml
[[Base64]]
uuid = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"
[[ColorTypes]]
deps = ["FixedPointNumbers", "Random", "Test"]
git-tree-sha1 = "b45e62af8eabea138c381c04972c4b25d47e6c69"
uuid = "3da002f7-5984-5a60-b8a6-cbb66c0b333f"
version = "0.7.3"
[[Colors]]
@mortenpi
mortenpi / moduletestset.jl
Created Jul 31, 2018
at-testset for modules
View moduletestset.jl
using Test
macro moduletestset(ex)
@assert ex.head === :module
modulename = string("module ", ex.args[2])
modulecontents = ex.args[3]
# Add `using Test` as the first expression in the module so that the user could
# use @test etc. without having to have `using Test` all over the place.
pushfirst!(modulecontents.args, :(using Test))
# Just having `using Test` as the very first element in does not work for some
@mortenpi
mortenpi / Markdown2.printmd2.jl
Created Jun 2, 2018
printmd2() functions to print Markdown2 trees in Documenter
View Markdown2.printmd2.jl
# printmd2
const INDENT = ". "
printmd2(xs :: Markdown2.MD) = printmd2(xs.nodes)
function printmd2(xs :: Vector; indent=0)
for x in xs
printmd2(x; indent = indent)
end
end
View json-escape-benchmark.jl
function jsonescape(s)
s = replace(s, '\\' => "\\\\")
s = replace(s, '\n' => "\\n")
replace(s, '"' => "\\\"")
end
@static if VERSION < v"0.7.0-DEV.3734" # https://github.com/JuliaLang/julia/pull/25872
function iobuffer(sizehint)
b = IOBuffer(Base.StringVector(floor(Int, 1.2*sizehint)), true, true)
truncate(b, 0)
@mortenpi
mortenpi / documenter-api-updates.jl
Last active Apr 11, 2018
Some speculation about the future of Documenter's user-facing API.
View documenter-api-updates.jl
# This would be make.jl.
#
# The user can then interact with this configuration through the
# command line:
#
# julia docs/make.jl doctest
# julia docs/make.jl build --html
# julia docs/make.jl deploy --latex --html
using Documenter, DocumenterLaTeX
@mortenpi
mortenpi / read_urandom.cc
Created Mar 24, 2014
Short generic C++ function to read random data of any type from /dev/urandom.
View read_urandom.cc
#include <fstream>
#include <cstdlib>
template<class T>
T read_urandom()
{
union {
T value;
char cs[sizeof(T)];
} u;
@mortenpi
mortenpi / 0 Dropbox
Last active Aug 1, 2017
Setup for second Dropbox folder
@mortenpi
mortenpi / clean-urls.diff
Created May 25, 2017
search.html (v0.10.3) vs search/index.html (v0.11.0)
View clean-urls.diff
24c24
< "https://fonts.googleapis.com/css?family=Lato|Ubuntu+Mono" rel=
---
> "https://fonts.googleapis.com/css?family=Lato|Roboto+Mono" rel=
30c30
< documenterBaseURL="."
---
> documenterBaseURL=".."
34,39c34,39
< data-main="assets/documenter.js"></script>
You can’t perform that action at this time.