Skip to content

Instantly share code, notes, and snippets.

View redhog's full-sized avatar

Egil Möller redhog

View GitHub Profile
@redhog
redhog / emerald-beryl-pipeline-cobertura-coverage.json
Last active July 22, 2024 08:13
emerald-geomodelling/experimental-pipeline-inversion status
{"schemaVersion":1,"label":"coverage","message":"55%","color":"yellow"}
{}
<!DOCTYPE NETSCAPE-Bookmark-file-1>
<!-- This is an automatically generated file.
It will be read and overwritten.
DO NOT EDIT! -->
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
<TITLE>Bookmarks</TITLE>
<H1>Bookmarks</H1>
<DL><p>
<DT><H3 ADD_DATE="0" LAST_MODIFIED="1593032001" PERSONAL_TOOLBAR_FOLDER="true">Bookmarks bar</H3>
<DL><p>
@redhog
redhog / gen.py
Created September 4, 2020 15:44
#! /usr/bin/env python
#
# Run this before running this script
# pip install CppHeaderParser
# Run as python gen.py header.h
# Prints C file with printer-funbctions.
import json, CppHeaderParser, sys
cppHeader = CppHeaderParser.CppHeader(sys.argv[1])
@redhog
redhog / antihadoop.py
Created March 13, 2017 14:52
antihadoop
import luigi
import btarget
FIELDSEP="--{FIELDSEP}--"
class SubTask(luigi.Task):
job_task = luigi.Parameter(description="JobTask")
@property
def job_task_inst(self):
ODE TO PROGRAMMING
-------------------
Fire in the hall!
A bug on the wall!
Take it down, patch it around.
Two bugs on the wall.
Two bugs on the wall.
Take one down, patch it around.
@redhog
redhog / test.py
Created May 31, 2016 16:45
test.py
import numpy
import sys
import datetime
def hours_per_day(latitude, day_of_year):
# From https://www.quora.com/How-can-you-calculate-the-length-of-the-day-on-Earth-at-a-given-latitude-on-a-given-date-of-the-year
latitude = numpy.radians(latitude)
# compute declination using approx from
# https://en.wikipedia.org/wiki/Position_of_the_Sun
# XXX check that day_of_year is correcly 0 or 1 referenced
Getting org.scala-sbt sbt 0.13.7 ...
:: problems summary ::
:::: WARNINGS
module not found: org.scala-sbt#sbt;0.13.7
==== local: tried
/home/redhog/.ivy2/local/org.scala-sbt/sbt/0.13.7/ivys/ivy.xml
@redhog
redhog / Class members and class methods
Created November 8, 2014 13:56
Some more about classes
#### Sometimes you only have one of something, so no reason to make instances:
class X(object):
base = 13
@classmethod
def foo(cls, a, b):
return cls.base + a + b
class Y(X):
@redhog
redhog / cfsdf
Last active August 29, 2015 14:08
Test class
class Galaxy(object):
def __init__(self, size, expansionRate):
self.size = size
self.time = 0
self.expansionRate = expansionRate
def update(self):
self.time += 1
self.size += self.expansionRate