Skip to content

Instantly share code, notes, and snippets.

View mortenpi's full-sized avatar

Morten Piibeleht mortenpi

View GitHub Profile
@mortenpi
mortenpi / clean-urls.diff
Created May 25, 2017 11:32
search.html (v0.10.3) vs search/index.html (v0.11.0)
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>
@mortenpi
mortenpi / documenter-world-counter.patch
Last active May 19, 2017 10:04
Work around the world counter issue in Documenter
diff --git a/src/Expanders.jl b/src/Expanders.jl
index 484622f..f7025f4 100644
--- a/src/Expanders.jl
+++ b/src/Expanders.jl
@@ -471,11 +471,7 @@ function Selectors.runner(::Type{ExampleBlocks}, x, page, doc)
# Splice the input and output into the document.
content = []
input = droplines(x.code)
-
- # Special-case support for displaying SVG graphics. TODO: make this more general.
julia> Pkg.update()
INFO: Updating METADATA...
ERROR: METADATA cannot be updated. Resolve problems manually in /home/morten/Julia/pkg/v0.5/METADATA.
GitError(Code:ERROR, Class:Net, Failed to resolve address for https: Name or service not known)
 in macro expansion at ./libgit2/error.jl:99 [inlined]
 in #fetch#52(::Base.LibGit2.FetchOptions, ::String, ::Function, ::Base.LibGit2.GitRemote, ::Array{AbstractString,1}) at ./libgit2/remote.jl:70
 in (::Base.LibGit2.#kw##fetch)(::Array{Any,1}, ::Base.LibGit2.#fetch, ::Base.LibGit2.GitRemote, ::Array{AbstractString,1}) at ./<missing>:0
 in #fetch#93(::String, ::String, ::Array{AbstractString,1}, ::Nullable{Base.LibGit2.AbstractCredentials}, ::Function, ::Base.LibGit2.GitRepo) at ./libgit2/libgit2.jl:164
 in (::Base.Pkg.Entry.##35#41)(::Base.LibGit2.GitRepo) at ./pkg/entry.jl:371
@mortenpi
mortenpi / gadfly-spy-test.jl
Created December 29, 2015 17:02
Gadfly spy() test
if length(ARGS) != 1
error("Output file name not provided!")
end
ofile = ARGS[1]
println("Writing the plot to: $ofile")
using Gadfly
M,N = 22,30
matrix = zeros(Float64, (M,N))
for i=1:M, j=1:N
#!/bin/bash
echo "Working directory:" `pwd`
date
echo
echo "SLURM variables"
# For a full list, see http://slurm.schedmd.com/sbatch.html
echo SLURM_JOB_ID=${SLURM_JOB_ID}
echo SLURM_JOB_NAME=${SLURM_JOB_NAME}
echo SLURM_JOB_NODELIST=${SLURM_JOB_NODELIST}
@mortenpi
mortenpi / softwarecenter.css
Last active November 15, 2015 15:47
A better style for the Ubuntu Software Center (/usr/share/software-center/ui/gtk3/css/softwarecenter.css)
@define-color light-aubergine #BBBBBB;
@define-color super-light-aubergine #EDEDED;
/*
do not use text-shadow until bugzilla.gnome.org bug #686209 is
fixed - its leaking memory
*/
#featured-star {
@mortenpi
mortenpi / time_lm.jl
Created October 3, 2015 16:19
Time a function multiple times to see how memory usage behaves.
import Base: gc_bytes, gc_time_ns, time_print
function lm_1_10(x1, x10)
A = (x10-x1)/9
B = (10*x1-x10)/9
A,B
end
macro time_N(N, ex)
quote
@mortenpi
mortenpi / bit.jl
Created September 28, 2015 14:54
Get the nth bit of a number in Julia.
# Gets the Nth bit of m
function bit(N, m)
m & (1<<(N-1)) >> (N-1)
end
@show [bit(n,0) for n=1:5]
@show [bit(n,1) for n=1:5]
@show [bit(n,2) for n=1:5]
@show [bit(n,3) for n=1:5]
@show [bit(n,5) for n=1:5]
@mortenpi
mortenpi / ComposeHacks.jl
Last active September 21, 2015 18:56
A collection of helper macros and stuff for Julia's Compose and Gadfly packages.
# ComposeHacks module
#
# This module is a collection of hacks to make working with Compose and Gadfly
# more convenient (in Julia).
#
# The MIT License (MIT)
#
# Copyright (c) 2015 Morten Piibeleht
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
@mortenpi
mortenpi / NoninteractiveGadfly.jl
Created September 7, 2015 14:06
Makes the plots in Gadfly non-interactive (Juno lags with interactive plots)
module NoninteractiveGadfly
import Compose
import Compose: writemime
import Gadfly
export @noninteractive
type NoninteractivePlot
p::Gadfly.Plot
end