Skip to content

Instantly share code, notes, and snippets.

View ties's full-sized avatar

Ties de Kock ties

  • The Netherlands
View GitHub Profile
/**
* Regular expressions in javascript...
*
* Given that
*/
'abc'.match(new RegExp('ab.'));
// returns what is logged by
console.log([ 'abc', index: 0, input: 'abc' ])
// and
'abc'.match(new RegExp('mis'))
// @flow
//
// flow-annotated variant of https://github.com/izaakschroeder/cartesian-product
//
function product<T>(...elements: $ReadOnlyArray<$ReadOnlyArray<T>>): $ReadOnlyArray<$ReadOnlyArray<T>> {
const end = elements.length - 1;
const result: Array<Array<T>> = [];
function addTo(curr: Array<T>, start: number) {
const first = elements[start];
product month sales
Product A 2017-12 0
Product A 2018-01 36
Product A 2018-02 27
Product A 2018-03 45
Product A 2018-04 46
Product A 2018-05 41
Product A 2018-06 59
Product A 2018-07 53
Product A 2018-08 67
# /etc/telegraf/telegraf.d/mqtt_consumer.conf
# Read metrics from MQTT topic(s)
[[inputs.mqtt_consumer]]
servers = ["localhost:1883"]
## MQTT QoS, must be 0, 1, or 2
qos = 0
## Topics to subscribe to
topics = [
"telegraf/host01/cpu",
from z3 import Solver, EnumSort, Const, Distinct
s = Solver()
Color, (red, green, blue) = EnumSort('Color', ['red', 'green', 'blue'])
a = Const('a', Color)
b = Const('b', Color)
s.add(Distinct(a, b))
s.check()
@ties
ties / printcall_util.py
Last active June 13, 2017 13:58
Utility that prints calls on the attribute path of the object
import logging
logging.basicConfig()
logging.getLogger(__name__).setLevel(logging.INFO)
LOG = logging.getLogger(__name__)
class PrintCalls(object):
"""
Log all the calls done on this object. This object wraps, and redirects
/**
* An higher order component that provides the 'isAuthenticated' prop to it's
* children
*/
import React, { PropTypes } from 'react';
import { connect } from 'react-redux';
import { createStructuredSelector } from 'reselect';
import { selectIsAuthenticated } from './selectors';
@ties
ties / all_inkoopdata.py
Last active February 22, 2017 13:17
Utility: Download alle open inkoopdata bestanen vanaf data.overheid.nl
"""
Utility: Download alle open inkoopdata bestanen vanaf data.overheid.nl
Dependencies: requests, ckanapi
Copyright (c) 2017 T. de Kock
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
#
# Python code written by undergraduate math student:
#
i = 1
while i in range(1, 10):
print(i)
i += 1