Skip to content

Instantly share code, notes, and snippets.

@ostcar
ostcar / Anleitung.rst
Last active August 29, 2015 14:27
Anleitung zum versenden der eigenen Passwörter an eine Vertrauensperson (in german)

Key Export

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

Hintergrund

@ostcar
ostcar / cache.py
Created October 13, 2015 06:33
redis get_or_set
class RedisCache(_RedisCache):
"""
Wrapper to redis cache that creates status keys for the time a value is
created.
Idea from https://github.com/funkybob/puppy
"""
def get_or_set(self, key, callback, timeout=None, update_time=6):
"""
Get a key if it exists. Creates it if other case.
@ostcar
ostcar / openslides.yml
Created October 26, 2015 09:17
ansible playbook to install an openslides system
---
# 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
tasks:
- name: Install required packages and update package cache
pacman:
name: "{{ item }}"
import os
import sys
from time import sleep
from usb.core import find as usb_find, USBError
def call_usb(func):
def wrapper(self, *args, **kwargs):
try:
func(self, *args, **kwargs)
@ostcar
ostcar / openslides.yml
Created May 10, 2016 22:49
Create openslides inside ubuntu 16.04
---
- hosts: openslides
become: yes
vars:
settings_path: /etc/openslides
user_data_path: /usr/local/lib/openslides
secure_key: 'MakeMeRANDOM'
domain: openslides.oshahn.de
@ostcar
ostcar / openslides_ws_test.py
Created November 11, 2016 18:28
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/'
CONNECTION_COUNT = 500
@ostcar
ostcar / inyoka_dev.yml
Created October 13, 2015 14:45
systemd-nspawn config for inyoka providing mysql and redis
---
- hosts: inyoka_dev
tasks:
- name: enable network
service:
name: "{{ item }}"
state: started
enabled: yes
with_items:
@ostcar
ostcar / all_data_dict.py
Last active January 25, 2019 20:52
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
ostcar / bigjson.go
Created January 13, 2020 22:09
Test decoding of big list of ints
package main
import (
"bytes"
"encoding/binary"
"encoding/json"
"fmt"
"io"
"strconv"
"time"

Keybase proof

I hereby claim:

  • I am ostcar on github.
  • I am ostcar (https://keybase.io/ostcar) on keybase.
  • I have a public key ASCTQlqdzbn1FxrCM8hmPe1KsjR1IcTcj0V0y3Cofv9qogo

To claim this, I am signing this object: