Skip to content

Instantly share code, notes, and snippets.

View marians's full-sized avatar

Marian Steinbach marians

View GitHub Profile
@marians
marians / CouchDB_Python.md
Last active April 9, 2024 12:21
The missing Python couchdb tutorial

This is an unofficial manual for the couchdb Python module I wish I had had.

Installation

pip install couchdb

Importing the module

@marians
marians / Chromium Linux.md
Last active March 12, 2024 06:32
How to install CA certificates and PKCS12 key bundles on different platforms

We install certutil and pk12util if necessary:

sudo apt install libnss3-tools

On Linux, Chromium uses the NSS Shared DB. Check if you have the ~/.pki/nssdb directory:

ls $HOME/.pki/nssdb
@marians
marians / main.go
Created January 27, 2017 10:25
OAuth 2.0 authentication in a Golang CLI
package main
import (
"context"
"crypto/tls"
"fmt"
"log"
"net/http"
"net/url"
"time"
@marians
marians / main.py
Last active January 18, 2024 21:57
Modellierung eines Balkonkraftwerks mit pvlib-python und PVGIS
# Modellierung eines Balkonkraftwerks
# mit Hoymiles 600 Watt Mikrowechselrichter
# und 2 Modulen Typ Canadian Solar CS3L-370MS.
# Ausrichtung: 155 (Süd-Süd-Ost), Neigung 12 Grad.
# Vollständige Verschattung von Westen bis Norden (270° bis 0°)
# durch Gebäude.
#
# Es wird das Wetter des typischen meteorologischen Jahrs (TMY)
# auf Basis der Daten von 2005 bis 2020 verwendet. Mehr dazu
# unter https://joint-research-centre.ec.europa.eu/pvgis-online-tool/pvgis-tools/pvgis-typical-meteorological-year-tmy-generator_en
@marians
marians / couchimport.py
Created November 11, 2011 11:57
Import of certain CSV data from STDIN to CouchDB
#!/opt/local/bin/python2.7
# encoding: utf-8
"""
couchimport.py
Created by Marian Steinbach on 2011-11-10.
"""
import sys
import os
import datetime
@marians
marians / german-porter-stemmer.js
Created April 26, 2011 14:06
German Porter Stemmer in JavaScript
/* by Joder Illi, Snowball mailing list */
function stemm(word) {
/*
Put u and y between vowels into upper case
*/
word = word.replace(/([aeiouyäöü])u([aeiouyäöü])/g, '$1U$2');
word = word.replace(/([aeiouyäöü])y([aeiouyäöü])/g, '$1Y$2');
/*
and then do the following mappings,
@marians
marians / README.md
Last active January 25, 2022 07:35
Home Assistant ideas

What to do with Home Assistant

Some ideas I might pursue at some point.

Air humidity alert

When air humidity reaches a threshold value, get an alert on my phone.

Make sure to be alerted only once.

@marians
marians / README.md
Last active August 17, 2021 20:24
Recherche zum Thema Stecker-Solaranlage, Plugin-PV, Plug-and-Play PV, Balkonkraftwerk, you name it

Ziel

Solaranlage an einer Mietwohnung mit großem Balkon in südlicher Ausrichtung anbringen, weniger Strom vom Energieversorger verbrauchen, Geld sparen, Energiewende unterstützen.

Hinweis: Die Informationen trage ich im August 2021 für meinen Wohnort, der im Bereich der Regionetz GmbH Aachen liegt, zusammen.

Offene Fragen

  • Anlage anmelden oder lieber "schwarz" (ohne Anmeldung) betreiben?
  • Was steht in der Norm VDE-AR-N 4105? Diese kann man nur käuflich erwerben.
@marians
marians / esp8266-dht-webthing.ino
Last active April 9, 2021 23:47
ESP8266 publishing DHT temperature and humidity via Web Thing API
/**
* Publishing DHT temperature and humidity via the Web Thing API.
*
* This should work with DHT11, DHT21, DHT22 alike thanks to
* device auto detection in the markruys/arduino-DHT library.
*
* This will make the device available under http://livingroom.local/
* for msdns-aware clients.
*
* Dependencies:
@marians
marians / bench.py
Last active March 30, 2021 14:30
Benchmarking serialization/unserialization in python using json, pickle and cPickle
import cPickle
import pickle
import json
import random
from time import time
from hashlib import md5
test_runs = 1000
def float_list():