Skip to content

Instantly share code, notes, and snippets.

View gnn's full-sized avatar

Stephan Günther gnn

View GitHub Profile
@gnn
gnn / .vimperatorrc
Created January 3, 2012 22:02
Current vimperatorrc file.
"2.2 (created: 2009/10/28 19:04:27)
set ht="//*[@onclick or @onmouseover or @onmousedown or @onmouseup or @oncommand or @class='lk' or @role='link' or @role='button' or @role='option'] | //input[not(@type='hidden')] | //a | //area | //iframe | //textarea | //button | //select | //xhtml:input[not(@type='hidden')] | //xhtml:a | //xhtml:area | //xhtml:iframe | //xhtml:textarea | //xhtml:button | //xhtml:select | //div[contains(@class,'J-K-I J-J5-Ji')]"
set eht="//*[@onclick or @onmouseover or @onmousedown or @onmouseup or @oncommand or @class='lk' or @role='link' or @role='button' or @role='option'] | //input[not(@type='hidden')] | //a | //area | //iframe | //textarea | //button | //select | //xhtml:input[not(@type='hidden')] | //xhtml:a | //xhtml:area | //xhtml:iframe | //xhtml:textarea | //xhtml:button | //xhtml:select | //div[contains(@class,'J-K-I J-J5-Ji')]"
set editor=/usr/local/bin/external-editor.sh
set runtimepath=/Users/gnn/.vimperator
javascript <<BLOCK
(function(){
var feedPanel = document.creat
@gnn
gnn / invest_test.py
Last active May 11, 2016 23:02 — forked from uvchik/invest_test.py
test the invest
from oemof.network import Source
class Investment:
""" Components (Nodes?) grouped under `Investment` objects are optimized
for investment.
"""
def __init__(self, maximum=float('+inf')):
self.maximum = maximum
@gnn
gnn / sorting.dol
Last active August 18, 2016 17:03
A proposed fix for the "attempt to hide ... from the local environment" error
spec Sorting =
TotalOrder and List
then {
preds is_ordered : List;
permutation : List * List
vars x,y:Elem; L,L1,L2:List
. is_ordered([])
. is_ordered(x::[])
. is_ordered(x::y::L) <=> x<=y /\ is_ordered(y::L)
. permutation(L1,L2) <=> (forall x:Elem . count(x,L1) = count(x,L2))
@gnn
gnn / grid.geojson
Last active April 2, 2020 11:31
Geojson files generated with open_FRED's grid
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@gnn
gnn / grid.geojson
Created April 2, 2020 11:49
The grid used by open_FRED
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@gnn
gnn / results.md
Last active November 17, 2020 15:49
The results of the model development coordination poll.

Topic Partitioning Votes

These are the most significant polling results:

Partitioning Votes
2, 3 5
7, 9 5
5, 6 4
10 4
@gnn
gnn / extract-zipfile.py
Last active December 1, 2020 13:34
Using zipped files with Python
import os
import zipfile
with zipfile.ZipFile(PATH_TO_ZIPFILE) as zf:
for filename in zf.namelist():
zf.extract(filename)
# Do stuff with `filename`.
os.remove(filename)
@gnn
gnn / tests.rst
Last active January 13, 2021 09:45
Try out various reStructuredText features and whether and how they are rendered on GitHub

Math

Here's a math block. Let's see how it's rendered.

$$\sum_{n=1}^{\infty}$$

Apparently not at all. So what about the same thing inlined:

@gnn
gnn / rasterize.py
Last active January 19, 2021 12:18
Read in CSV data and rasterize it
from functools import partial
import json
from geocube.api.core import make_geocube
from geocube.rasterize import rasterize_image
from rasterio.enums import MergeAlg
from shapely.wkt import loads
from shapely.geometry import box, mapping, MultiPoint
import pandas as pd
import geopandas as gpd
@gnn
gnn / filter.py
Last active February 23, 2021 11:39
Filter CSV lines using a shapefile
#! /usr/bin/env python
from pathlib import Path
import csv
import json
from shapely.geometry import Point, shape
from shapely.prepared import prep
from egon.data import subprocess