Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Eivind Fonn TheBB

🏠
Working from home
View GitHub Profile
@TheBB
TheBB / a.lr
Last active May 5, 2020
LRSpline bug
View a.lr
# LRSPLINE VOLUME
# p1 p2 p3 Nbasis Nline Nel dim rat
2 2 2 1433 107 1041 3 0
# Basis functions:
0: [0 0 0.02000000000000002 ] x [0 0 0.1666666666666667 ] x [0 0 0.5 ] 0 -2.3 29.77 (1)
1: [0.98 1 1 ] x [0 0 0.1666666666666667 ] x [0 0 0.5 ] 48.5 -2.3 29.77 (1)
2: [0.64 0.6599999999999999 0.6799999999999999 ] x [0 0 0.1666666666666667 ] x [0 0 0.5 ] 32.00999999999999 -2.3 29.77 (1)
3: [0.24 0.26 0.28 ] x [0 0 0.1666666666666667 ] x [0 0 0.5 ] 12.61 -2.3 29.77 (1)
4: [0.5800000000000001 0.6 0.64 ] x [0 0 0.3333333333333333 ] x [0 0 1 ] 29.09999999999999 -2.3 29.77 (1)
5: [0.5800000000000001 0.6 0.64 ] x [0 0 0.3333333333333333 ] x [0 1 1 ] 29.09999999999999 -2.3 30 (1)
View compile_commands.json
[
{
"directory": "/home/eivind/repos/grim/build/vendor",
"command": "/usr/bin/cc -Dmunit_EXPORTS -g -fPIC -o CMakeFiles/munit.dir/munit/munit.c.o -c /home/eivind/repos/grim/vendor/munit/munit.c",
"file": "/home/eivind/repos/grim/vendor/munit/munit.c"
},
{
"directory": "/home/eivind/repos/grim/build/vendor",
"command": "/usr/bin/cc -g -fPIC -o CMakeFiles/zhash.dir/zhash-c/src/zhash.c.o -c /home/eivind/repos/grim/vendor/zhash-c/src/zhash.c",
"file": "/home/eivind/repos/grim/vendor/zhash-c/src/zhash.c"
@TheBB
TheBB / cars.org
Last active Jun 26, 2019
Wedding schedule
View cars.org

Car transport table

  • People in brackets are drivers and “main people”.
  • There’s some room for flexibility (especially Sunniva and Thor can switch Passat and Golf more or less as they wish)
  • Passat and Peugeot are the biggest cars, Kun in wedding dress should never be in the Golf or the Hyundai
  • Also, avoid five people in a car if Kun in wedding dress is one of them
  • Especially avoid five people in a car if Kun in wedding dress and Sven with photo gear are both there
  • The words “get” and “put” mean to leave someone or something behind or pick someone or something up, respectively
  • “The Lius” are: Kun’s parents, sister and cousin (four people)

Peugeot (home base Flatåsen)

View after-change-bytes.el
(defvar-local bb--region-before-change nil)
(defun bb--before-change (beg end)
(setq-local bb--region-before-change
(cons beg (buffer-substring-no-properties beg end))))
(defun bb--after-change (beg end len)
(let* ((pre-beg (car bb--region-before-change))
(pre-str (cdr bb--region-before-change))
(nbytes (string-bytes (substring pre-str (- pre-beg beg) len))))
View 18-124531.py
from functools import wraps
from inspect import getclosurevars
# WITH wraps
def hyphen_decorator(func):
@wraps(func)
def ret():
print('----')
View poisson.c
/**
* C program to solve the two-dimensional Poisson equation on
* a unit square using one-dimensional eigenvalue decompositions
* and fast sine transforms.
*
* Einar M. Rønquist
* NTNU, October 2000
* Revised, October 2001
* Revised by Eivind Fonn, February 2015
*/
View test.py
import numpy as np
import timeit
from nutils import core, log, function as fn, plot, _, mesh
def one(domain, basis, z):
mx = basis[:,_,_] * basis[_,:,_] * basis[_,_,:]
mx = (mx[:,_,:,_,:,_] * z[:,:,_,_,_,_] * z[_,_,:,:,_,_] * z[_,_,_,_,:,:]).sum([0, 2, 4])
return domain.integrate(mx, ischeme='gauss9')
View 03-093147.py
from astropy import coordinates as coords, time, units as u
from datetime import datetime, timezone
import numpy as np
now = time.Time.now()
wageningen = coords.EarthLocation(lat=51.9692*u.deg, lon=5.6654*u.deg, height=9*u.m)
for mins in 15 * np.arange(40):
timept = now + mins * u.minute
View 02-152824.py
from nutils import mesh, function as fn, plot
import numpy as np
xpts = np.linspace(0, 4, 5)
domain, geom = mesh.rectilinear([xpts])
basis = domain.basis('spline', 3, knotmultiplicities=[[4, 1, 3, 1, 4]])
dofs = [0, 0, 0, .5, 1, .5, 0, 0, 0]
func = basis.dot(dofs)
View rbspacetest.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.