Skip to content

Instantly share code, notes, and snippets.

View tomasaschan's full-sized avatar

Tomas Aschan tomasaschan

View GitHub Profile
@tomasaschan
tomasaschan / install.log
Created January 2, 2018 13:17
Verbose paket log
.\.paket\paket.exe install --verbose
Paket version 5.128.1
found: D:\Code\F# Foundation\AProjectHasNoName\src\paket.dependencies
Parsing D:\Code\F# Foundation\AProjectHasNoName\src\paket.dependencies
Skipping resolver for group Main since it is already up-to-date
D:\Code\F# Foundation\AProjectHasNoName\src\paket.lock is already up-to-date
Installing into projects:
- Creating model and downloading packages.
System.Reflection.Metadata 1.5 already downloaded.
runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.Apple 4.3.1 already downloaded.
using System;
using System.Collections.Generic;
using AutoMapper;
using Newtonsoft.Json;
namespace SetsWithEqualityComparers
{
internal class Program
{
private static void Main()
@tomasaschan
tomasaschan / terminology.md
Created August 6, 2017 15:17
CI system terminology

Terminology for CI systems

@tomasaschan
tomasaschan / foo-arrays.jl
Last active August 12, 2016 08:02
Alternative to @eval in @generated functions
# not really needed other than for readability
typealias DimPoint Union{Int,Symbol}
# expand_dims makes sure that all dims are on the form ((lower,step,upper),...),
# even if initially specified e.g. as (upper, (lower,upper), ...) etc
expand_dims(upper::DimPoint) = (1,1,upper)
expand_dims(unit::NTuple{2,DimPoint}) = (unit[1], 1, unit[2])
expand_dims(full::NTuple{3,DimPoint}) = full
function expand_dims(dims)
map(dims) do dim
var regex = /\<(.*)(?:\|[^\|]+)?\>/g;
var testStrings = [
"<http://this.is.a.url/foobar>",
"<https://this.too> and <http:/this.one> with some extra info",
"it doesn't have to start with a <net.tcp://odd.prodocol/>",
"and <no.protocol> is needed",
"This <http://one.has|A name>!",
"this isn't a match",
"this has a <http://google.com|link> inside other text",
@tomasaschan
tomasaschan / session-log.jl
Created October 16, 2015 11:33
Julia session without ENV["HOME"] on Windows
_
_ _ _(_)_ | A fresh approach to technical computing
(_) | (_) (_) | Documentation: http://docs.julialang.org
_ _ _| |_ __ _ | Type "?help" for help.
| | | | | | |/ _` | |
| | |_| | | | (_| | | Version 0.4.0 (2015-10-08 06:20 UTC)
_/ |\__'_|_|_|\__'_| | Official http://julialang.org/ release
|__/ | x86_64-w64-mingw32
julia> cd(Pkg.dir("DualNumbers"))
@tomasaschan
tomasaschan / bench.jl
Created September 29, 2015 09:04
Globals vs Const Globals vs Closures
a = 3
const b = 3
g(f::Function, N) = f(N)
function f_glob(N)
s = 0
for i = 1:N
s += a
end
julia> Pkg.test("LightGraphs")
INFO: Testing LightGraphs
running C:\Users\Tomas Lycken\.julia\v0.4\LightGraphs\test\graphdigraph.jl ...
WARNING: gc_disable() is deprecated, use gc_enable(false) instead.error in running finalizer: ErrorException("task switc
h not allowed from inside gc finalizer")
WARNING: gc_enable() is deprecated, use gc_enable(true) instead.error in running finalizer: ErrorException("task switch
not allowed from inside gc finalizer")
running C:\Users\Tomas Lycken\.julia\v0.4\LightGraphs\test\persistence.jl ...
ERROR: LoadError: LoadError: unlink: resource busy or locked (EBUSY)
in unlink at fs.jl:102
# Define the following stuff somewhere
type ToroidalImage
img
end
import Base.getindex
getindex(timg::ToroidalImage, x, y) = timg.img[mod1(x, size(timg.img,1)), mod1(x, size(timg.img,2))]
@tomasaschan
tomasaschan / gist:81eaa3ea63b6f044fe84
Created March 17, 2015 17:04
Macro name mangling
julia> macro maketype(name)
println(name, " <: ", typeof(name))
q = quote
immutable $name
v
end
$name(a,b) = $name(a + b)
end
println(q)
q