Skip to content

Instantly share code, notes, and snippets.

View michalmikolajczyk's full-sized avatar

Michał Mikołajczyk michalmikolajczyk

View GitHub Profile
@michalmikolajczyk
michalmikolajczyk / epcis-example.xml
Created June 15, 2018 12:26
EPCIS example event
<epcis:EPCISDocument xmlns:epcis="urn:epcglobal:epcis:xsd:1" schemaVersion="1.1" creationDate="2015-04-14T09:33:00.597-04:00">
<EPCISBody>
<EventList>
<ObjectEvent>
<eventTime>2014-03-15T10:11:12.000Z</eventTime>
<eventTimeZoneOffset>-05:00</eventTimeZoneOffset>
<epcList>
<epc>urn:epc:id:sscc:0614141.0123456789</epc>
</epcList>
<action>OBSERVE</action>
➜ bin ./hey -n 50000 -c 50000 http://michalmikolajczyk.com
Summary:
Total: 27.8550 secs
Slowest: 27.8415 secs
Fastest: 1.2430 secs
Average: 24.6406 secs
Requests/sec: 1795.0087
Response time histogram:
1.243 [1] |
@michalmikolajczyk
michalmikolajczyk / Machine.sol
Created December 11, 2017 01:28
Smart Contract to represent a machine on blockchain, with basic rental interface
pragma solidity ^0.4.18;
import '../node_modules/zeppelin-solidity/contracts/token/ERC20Basic.sol';
import '../node_modules/zeppelin-solidity/contracts/token/SafeERC20.sol';
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
// Code goes here
var regexString = '([^-]*)';
var flags = 'ig';
var regex = new RegExp(regexString, flags);
var arr = ['some-property-image.png', 'another-prop-video.png', 'y-no-work.bmp'];
var result = [];
arr.forEach(function (item) {
@michalmikolajczyk
michalmikolajczyk / gist:945460ea2d3bd695cb1c
Created January 8, 2015 22:11
some codility identical indices test
var A = [];
A[0] = 3;
A[1] = 5;
A[2] = 6;
A[3] = 3;
A[4] = 3;
A[5] = 5;
// this is NodeJS connecting to SQL Server using tedious http://pekim.github.io/tedious/
// which supports only one active db input at a time
// So I run the connections through a helper functions that disables input until the request is done
// It also checks availability by running itself recursively.
//
// Used in backend NodeJS app for an AngularJS Angular UI Calendar (FullCalendar) app
//
//
// below excerpt fromsendMail.js module:
@michalmikolajczyk
michalmikolajczyk / syncLoop.js
Created December 31, 2012 10:22
The syncLoop() function creates a recursive, synchronous loop executed for each element of a given array and accepts callbacks. Example appliance: wait for user input before proceeding to the next element, without the need to execute the loop asynchronously (useful for dynamic code / metaprogramming) Notice that tail recursion isn't optimized in…
/*
* The syncLoop() function creates a synchronous loop
* that executes recursively for each element of a given array
* and accepts callbacks.
*
* I needed to wait for user input inside the loop and
* could not use process the elements asynchronously
* thus, here is the syncLoop()
*/