Skip to content

Instantly share code, notes, and snippets.

View ties's full-sized avatar

Ties de Kock ties

  • The Netherlands
View GitHub Profile
"""
An old fiddle when we were investigating the size of the ranges owned by Ziggo…
"""
import aiohttp
import asyncio
import json
import itertools
import netaddr
@ties
ties / routinator-grafana-prometheus-dashboard.json
Created January 12, 2020 16:25
Routinator dashboard for Grafana with Prometheus as datasource
{
"__inputs": [
{
"name": "DS_PROMETHEUS",
"label": "Prometheus",
"description": "",
"type": "datasource",
"pluginId": "prometheus",
"pluginName": "Prometheus"
}
from passlib.context import CryptContext
myctx = CryptContext(schemes=['argon2', 'bcrypt'], deprecated=['bcrypt'])
# h ~= hash('password', 'bcrypt')
h="$2b$12$/kdxAcUQ432BgwKzhTwGM.CKq7gDHAhgDIYE3zyTirDahma6EshhK"
myctx.needs_update(h)
# True
(verifies, new_hash) = myctx.verify_and_update("password", h)
@ties
ties / cbs_odata_ggplot2.Rmd
Created July 25, 2019 09:55
Een voorbeeld van CBS open data in combinatie met ggplot2
---
title: "Voorbeeld van CBS open data in combinatie met ggplot2"
output: html_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
list.of.packages <- c(
"cbsodataR", "smooth", "zoo", "Mcomp", "svglite"
@ties
ties / get_event_loop_tests.py
Last active May 8, 2019 08:57
Tests basic assumptions about running event loops.
"""
Tests basic assumptions about running event loops.
Gets and compares the result of `get_event_loop` with `get_running_loop` before
and after setting it to None.
A more strict situation than in the documentation holds (for Python 3.7.3),
given default event loop policy:
`get_event_loop` returns the same result after setting the event loop to None,
when ran from a coroutine.
version: '2.1'
services:
#
# Nextcloud
#
nextcloud:
image: nextcloud
depends_on:
- nextcloud-db
---
- name: Run windows updates and reboot if required
win_updates:
category_names:
- Application
- CriticalUpdates
- DefinitionUpdates
- SecurityUpdates
- UpdateRollups
- Updates
import { Mutation, MutationFn, MutationResult, Query } from "react-apollo";
import authenticationState from "./authentication-state.graphql";
import enrollMutation from "./enroll-mutation.graphql";
import {
authenticationState as authenticationStateType,
enrollmentStart as enrollmentStartType,
enrollMutation as enrollMutationType,
enrollMutationVariables,
"""
A utility script to copy the windows truetype fonts as recommended in [0].
[0]: https://pandasauce.org/post/linux-fonts/
"""
import argparse
import logging
import os
import shutil
import sys
"""
A basic logical error in Z3/python code.
In order to enumerate all valid solutions, a solution is added as a constraint that should not be
matched.
Two ways of writing; which is correct (bug present in code on stackoverflow...)
"""
def not_again(self, model) -> None:
"""Exclude a current solution from the future results."""