Skip to content

Instantly share code, notes, and snippets.

🏠
Working from home

Eivind Fonn TheBB

🏠
Working from home
Block or report user

Report or block TheBB

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@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.
View test-stokes.py
from nutils import mesh, function as fn, log, _, plot
import numpy as np
CASE = 'channel' # 'backstep', or 'channel'
DEGREE = 3
VISCOSITY = 1/20
if CASE == 'backstep':
# Three-patch domain
domain, geom = mesh.multipatch(
View evs.py
from nutils import mesh, function, plot, _
import numpy as np
import scipy as sp
nelems = 40
xs = np.linspace(0, 1, nelems + 1)
domain, geom = mesh.rectilinear([xs])
basis = domain.basis('spline', degree=2)
You can’t perform that action at this time.