Skip to content

Instantly share code, notes, and snippets.

ostcar / code.go
Created Nov 12, 2022
Show memory usage in go services
View code.go
// From
func intToByte(s uint64) string {
sizes := []string{"B", "kB", "MB", "GB", "TB", "PB", "EB"}
base := 1000.0
logn := func(n, b float64) float64 {
return math.Log(n) / math.Log(b)
if s < 10 {
ostcar / bigjson.go
Created Jan 13, 2020
Test decoding of big list of ints
View bigjson.go
package main
import (
ostcar /
Last active Jan 25, 2019
Example for an all_data_dict
from collections import UserDict
from typing import Any, Dict, Generator, Tuple, Union
ElementID = Tuple[str, int]
Element = Dict[str, Any]
CollectionType = Union[Dict[int, Element], "Collection"]
class AllData(UserDict):
def __init__(self, initialdata: Dict[str, CollectionType]) -> None:
ostcar /
Created Nov 11, 2016
Test mass connection to the openslides projector
#!/usr/bin/env python
import asyncio
import functools
from datetime import datetime, timedelta
import websockets
WEBSOCKET_URI = 'ws://localhost:8000/ws/projector/1/'

Keybase proof

I hereby claim:

  • I am ostcar on github.
  • I am ostcar ( on keybase.
  • I have a public key ASCTQlqdzbn1FxrCM8hmPe1KsjR1IcTcj0V0y3Cofv9qogo

To claim this, I am signing this object:

ostcar / openslides.yml
Created May 10, 2016
Create openslides inside ubuntu 16.04
View openslides.yml
- hosts: openslides
become: yes
settings_path: /etc/openslides
user_data_path: /usr/local/lib/openslides
secure_key: 'MakeMeRANDOM'
ostcar / openslides.yml
Created Oct 26, 2015
ansible playbook to install an openslides system
View openslides.yml
# This script excepts an up to date archlinux system with installed python2,
# openssh and sudo and a user account with sudo permissions you can connect
# to.
- hosts: openslides
- name: Install required packages and update package cache
name: "{{ item }}"
ostcar / inyoka_dev.yml
Created Oct 13, 2015
systemd-nspawn config for inyoka providing mysql and redis
View inyoka_dev.yml
- hosts: inyoka_dev
- name: enable network
name: "{{ item }}"
state: started
enabled: yes
ostcar /
Created Oct 13, 2015
redis get_or_set
class RedisCache(_RedisCache):
Wrapper to redis cache that creates status keys for the time a value is
Idea from
def get_or_set(self, key, callback, timeout=None, update_time=6):
Get a key if it exists. Creates it if other case.
ostcar / Anleitung.rst
Last active Aug 29, 2015
Anleitung zum versenden der eigenen Passwörter an eine Vertrauensperson (in german)
View Anleitung.rst

Key Export

Mit dieser Anleitung wird erklärt, wie Passwörter an vertrauensvolle Personen verteilt werden können.