Skip to content

Instantly share code, notes, and snippets.

View oyvinev's full-sized avatar

Øyvind Evju oyvinev

View GitHub Profile
@oyvinev
oyvinev / redirect.py
Created March 4, 2024 13:57
Simple redirect with message and countdown delay
#!/usr/bin/env python
from http import server as SimpleHTTPServer
import argparse
TEMPLATE = """
<html>
<head>
<title>Page moved</title>
</head>
<body style="display: flex; margin: 10rem; flex-direction: column; align-items: center;font-weight: bolder;">
[tool.poetry]
name = "gpbuilder"
version = "1.0.0rc1"
description = ""
authors = [""]
license = "MIT"
readme = "README.md"
[tool.poetry.group.pyd4.dependencies]
pyd4 = { git = "https://github.com/dotinspace/d4-format.git", branch = "arm-docker", subdirectory = "pyd4" }
import enum
import operator
OperatorEnum = enum.Enum(
"operator",
{"==": operator.eq, ">=": operator.ge, "<=": operator.le, ">": operator.gt, "<": operator.lt},
)
print(OperatorEnum["=="].value)
import enum
import operator
OperatorEnum = enum.Enum(
"operator",
{"==": operator.eq, ">=": operator.ge, "<=": operator.le, ">": operator.gt, "<": operator.lt},
)
print(OperatorEnum["=="].value)
def Al_h2(x):
return (1.00698 + 0.08183*x + 0.00537*x**2 + 0.0016*x**3 + -5.75818*10**(-5)*x**4 + 7.32321*10**(-7)*x**5 + -3.92223*10**(-9)*x**6 + 7.0807*10**(-12)*x**7)/100
def SiO2(x):
return (50 - Al_h2)/100
def aSi(x):
return (25 + Al_h2/2)/100
def void(x):
from dolfin import *
import numpy as np
import mshr
from IPython import embed
from cbcpost.utils.mpi_utils import gather, broadcast
def vec(x): return as_backend_type(x).vec()
def mat(A): return as_backend_type(A).mat()
class NormalRotation(PETScMatrix):