Skip to content

Instantly share code, notes, and snippets.

View freifrauvonbleifrei's full-sized avatar

Freifrau von Bleifrei freifrauvonbleifrei

View GitHub Profile
@freifrauvonbleifrei
freifrauvonbleifrei / map.html
Last active February 22, 2021 18:49
Map Leaflet Stuttgart bürgerinnenratklima
<script src="https://unpkg.com/leaflet@1.6.0/dist/leaflet.js"></script>
<link href="https://unpkg.com/leaflet@1.6.0/dist/leaflet.css" rel="stylesheet"/>
<script>
function cloneMarker(markerToClone) {
var marker = L.marker(markerToClone.getLatLng()).bindPopup(markerToClone.getPopup());
return marker;
}
@freifrauvonbleifrei
freifrauvonbleifrei / Bauvorhaben.md
Last active April 24, 2020 14:06
Checkliste Bauvorhaben in der Lokalpolitik -- zum Kopieren und ausfüllen

Checkliste Bauvorhaben in der Lokalpolitik

Oh oh eine neue Vorlage der Stadt zu einem Bauvorhaben. Wie prüfe ich das kritisch?

Beschreibung

  • was soll gemacht werden?
  • was ist da bisher?
  • mit welchen zwingenden Gründen wird die Maßnahme begründet? Ist jeder einzelne stichhaltig?
    • Im Zweifelsfall bei dienstälteren Mitgliedern nachfragen, wie sie das bewerten.
  • wurden alternative Pläne ernsthaft geprüft?
# Based on NERSC Cori config
# These package should be upgraded whenever there is a CDT or PE upgrade
packages:
all:
# default compilers defined by the system
# these reflect the current installed PE
compiler: [gcc@8.3.0, cce@9.0.2, intel/19.0.1.144, pgi/19.7.0]
providers:
mpi: [mpich]
mkl: [intel-mkl]
@freifrauvonbleifrei
freifrauvonbleifrei / compilers.yaml
Last active April 30, 2020 16:08
Spack setup for SuperMUC-NG
compilers:
- compiler:
environment: {
unset:
F77
}
target: x86_64
spec: intel@19.0.5.281
paths:
cc: /lrz/sys/intel/studio2019_u5/compilers_and_libraries_2019.5.281/linux/bin/intel64/icc
@freifrauvonbleifrei
freifrauvonbleifrei / git_clone_ssh_through_reverse_tunnel.md
Created December 19, 2019 15:29
Getting ssh internet access for firewalled systems, such as HPC systems

Getting github access on a firewalled system

This approach, based on [0] and [1] lets me reverse-tunnel through the local machine, to get github (and other) access on protected machines, such as HPC compute systems.

I put these lines in my local ~/.ssh/config file

Host somehpcsocks
 ProxyCommand ssh -D 2020 localhost nc -q 1 localhost 22
@freifrauvonbleifrei
freifrauvonbleifrei / visualization_adaptive_cubes.py
Last active November 11, 2019 10:46
Matplotlib script to visualize cubes with corresponding value
from __future__ import division
import os
import numpy as np
import pandas as pd
import math
import sys
# In[5]:
@freifrauvonbleifrei
freifrauvonbleifrei / bound_combinations.py
Created July 8, 2019 08:47
Python numpy: get all combinations of d ints within certain bounds
import numpy as np
def bound_combinations(lmin, lmax):
"""
example: bound_combinations([1,1], [2,3]) == [[1,1], [1,2], [1,3], [2,1], [2,2], [2,3]]
"""
assert len(lmax) == len(lmin)
d = len(lmax)
# get all the ranges as slices
ranges = tuple(slice(lmin[i],lmax[i]+1, 1) for i in range(llen))
@freifrauvonbleifrei
freifrauvonbleifrei / nrae.py
Last active July 1, 2019 10:11
Normalized Risk-Averting Error Loss in tensorflow
#from tensorflow internals
def _safe_mean(losses, num_present):
"""Computes a safe mean of the losses.
Args:
losses: `Tensor` whose elements contain individual loss measurements.
num_present: The number of measurable elements in `losses`.
Returns:
A scalar representing the mean of `losses`. If `num_present` is zero,
then zero is returned.
@freifrauvonbleifrei
freifrauvonbleifrei / gist:2a2953b56cf9b61caa0a7aa01a15cae4
Created July 1, 2019 09:22
Combined tensorflow loss to avoid negative outputs
# custom combined loss cf https://towardsdatascience.com/custom-tensorflow-loss-functions-for-advanced-machine-learning-f13cdd1d188a
loss_1 = tf.losses.huber_loss
def loss_2(labels, predictions):
k = tf.clip_by_value(predictions, -np.inf, 0)
# k = tf.cond(predictions < 0, lambda: 1 * -predictions, lambda: 0)
loss = tf.reduce_sum(-k)
return loss
negativity_loss_rate = 0.1