Skip to content

Instantly share code, notes, and snippets.

View tomasaschan's full-sized avatar

Tomas Aschan tomasaschan

View GitHub Profile
[sts] -----------------------------------------------------
[sts] Starting Gradle build for the following tasks:
[sts] :jar
[sts] -----------------------------------------------------
:compileJava UP-TO-DATE
:processResources UP-TO-DATE
:classes UP-TO-DATE
:jar
FAILURE: Build failed with an exception.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
using Base.Test
nonfatal_handler(r::Test.Success) = Test.default_handler(r)
function nonfatal_handler(r::Test.Failure)
print_with_color(:red, "Test FAILED: $(r.expr)")
println()
end
function nonfatal_handler(r::Test.Error)
print_with_color(:red, "ERROR during test: $(r.expr)")
println()
@tomasaschan
tomasaschan / notebook
Created May 15, 2014 08:13
A more thorough look on Julia's `::` syntax
{
"metadata": {
"language": "Julia",
"name": "A more thorough look at Julia's \"double colon\" syntax"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
@tomasaschan
tomasaschan / example.jl
Last active August 29, 2015 14:01
Grid interpolation problems
using PyPlot, Grid, DataFrames
# This reads a dataframe from a file with each row consisting of three values: R Z psi
# The data is column major, i.e. if you look at the first few rows they all have the same
# R value, but vary in Z
fielddata = readtable("psifield.txt"; separator=' ')
uniqr, uniqz = sort(unique(fielddata[:R])), sort(unique(fielddata[:Z]))
Nr, Nz = length(uniqr), length(uniqz)
Rs =[4.04,4.108125,4.17625,4.244375,4.3125,4.380625,4.44875,4.516875,4.585,4.653125,4.7212499999999995,4.789375,4.8575,4.925625,4.99375,5.061875000000001,5.130000000000001,5.198125,5.26625,5.334375,5.4025,5.470625,5.53875,5.6068750000000005,5.675000000000001,5.743125,5.81125,5.879375,5.9475,6.015625,6.08375,6.151875,6.220000000000001,6.288125,6.35625,6.4243749999999995,6.492500000000001,6.560625,6.62875,6.696875,6.765000000000001,6.833125000000001,6.90125,6.969374999999999,7.0375000000000005,7.105625,7.17375,7.241875,7.3100000000000005,7.378125000000001,7.44625,7.514375,7.5825000000000005,7.650625000000001,7.71875,7.786875,7.855,7.923125000000001,7.991250000000001,8.059375000000001,8.1275,8.195625,8.263750000000002,8.331875,8.4];
Zs = [-4.6,-4.531407407407407,-4.462814814814815,-4.394222222222222,-4.325629629629629,-4.257037037037036,-4.188444444444444,-4.119851851851852,-4.051259259259259,-3.9826666666666664,-3.9140740740740734,-3.8454814814814813,-3.7768888888888883,-3.7082962962962958,-3.6397037037037028,-
@tomasaschan
tomasaschan / norm-benchmark.jl
Last active August 29, 2015 14:02
Benchmarking some norms
function bench(N)
Base.vecnorm(rand(N,N),Inf)
maximum(abs(rand(N,N)))
Base.maxabs(rand(N,N))
if N < 100
@time for i in 1:100; Base.vecnorm(rand(N,N),Inf); end
@time for i in 1:100; maximum(abs(rand(N,N))); end
@time for i in 1:100; Base.maxabs(rand(N,N)); end
elseif N < 1000
@tomasaschan
tomasaschan / Baz.jl
Last active August 29, 2015 14:04
Importing and extending methods
module Baz
import Foo: bar
export Qux, bar
type Qux
x
end

Keybase proof

I hereby claim:

  • I am tlycken on github.
  • I am tlycken (https://keybase.io/tlycken) on keybase.
  • I have a public key whose fingerprint is D801 A484 96E4 0E26 CBCB 9C47 4D61 9C56 C46D A571

To claim this, I am signing this object:

@tomasaschan
tomasaschan / WebApiConfig.cs
Created March 5, 2015 11:21
WebApiConfig.cs
public static class WebApiConfig
{
public static void Configure(HttpConfiguration config)
{
var container = new WindsorContainer()
// These two are extension methods from our project
// They just set up our DI container and register all our services
.ConfigureForWebApi()
.ConfigureForAuditLogging();