Skip to content

Instantly share code, notes, and snippets.

View dews's full-sized avatar

Calvin Zheng dews

  • Taichung, Taiwan
View GitHub Profile
@dews
dews / modbus_rtu.py
Last active July 29, 2019 03:28
modbus_rtu #modbus
#!/usr/bin/env python
"""
Pymodbus Synchronous Client Examples
--------------------------------------------------------------------------
The following is an example of how to use the synchronous modbus client
implementation from pymodbus.
It should be noted that the client can also be used with
the guard construct that is available in python 2.5 and up::
@dews
dews / slim-redux.js
Last active March 7, 2021 14:03 — forked from gaearon/slim-redux.js
Add applyMiddleware and add example
function mapValues(obj, fn) {
return Object.keys(obj).reduce((result, key) => {
result[key] = fn(obj[key], key);
return result;
}, {});
}
function pick(obj, fn) {
return Object.keys(obj).reduce((result, key) => {
if (fn(obj[key])) {