Skip to content

Instantly share code, notes, and snippets.

View kinnala's full-sized avatar
🏛️

Tom Gustafsson kinnala

🏛️
  • Aalto University
  • Finland
View GitHub Profile
@kinnala
kinnala / instructions.md
Last active August 7, 2020 09:41
Running Wolfram Engine and Jupyter in a container

Perform the following steps:

docker pull davecwright3/jupyter-mathematica:v1.0
docker run -p 8888:8888 -it davecwright3/jupyter-mathematica:v1.0 /bin/bash
apt-get update
apt-get install libglu1
wolframscript

Then login into your account (get a license here: https://wolfram.com/developer-license). Quit wolframscript with Ctrl-D and run

@kinnala
kinnala / dirichlet_example.m
Last active September 18, 2020 07:41
Solve linear elasticity problem in Matlab
close all;
clear all;
% define geometry
g=[ 2.0000 2.0000 2.0000 2.0000 2.0000 2.0000 2.0000 2.0000
-0.7169 -0.1488 0.0706 0.6718 0.5185 0.2480 -0.1849 -0.3201
-0.1488 0.0706 0.6718 0.5185 0.2480 -0.1849 -0.3201 -0.7169
-0.0316 0.4644 0.0376 0.5215 -0.6358 -0.2630 -0.7560 -0.0676
0.4644 0.0376 0.5215 -0.6358 -0.2630 -0.7560 -0.0676 -0.0316
0 0 0 0 0 0 0 0
@kinnala
kinnala / gist:7775902
Created December 3, 2013 19:23
FFT w/ Hanning windowing (50% overlap of windows)
def fft_hann(t,pt,M):
"""
Perform FFT with Hanning windowing,
50% overlap of 2^M+1 windows.
The resulting spectra are averaged.
"""
# Amplitude correction of Hanning
ampl_corr = 2.
# Signal length
@kinnala
kinnala / gist:6376196
Created August 29, 2013 09:50
Soccerway API scraping example
import urllib2
import json
import re
class SoccerwayTeamMatches:
def __init__(self, teamId):
self.teamId = str(teamId)
self.data = {'all': [], 'home': [], 'away': []}
@kinnala
kinnala / gist:5ae04c836cf1f548f242
Last active September 18, 2020 07:43
A function for making Mathematica syntax more Lisp'y (joke)
$[x_] := If[SameQ[Head[x], List], x[[1]] @@ Map[$, Rest[x]], x]