Skip to content

Instantly share code, notes, and snippets.

View hyzhak's full-sized avatar
🤔
feel creative

Ievgenii Krevenets hyzhak

🤔
feel creative
View GitHub Profile
@hyzhak
hyzhak / component.js
Created January 15, 2019 22:45
track frequent component diff v0.1
/**
* try to track frequent component update without real neads of update
*/
//...
componentDidUpdate (prevProp) {
console.log('componentDidUpdate ',
this.props.collectionId,
'\ndiff:\n',
Object.entries(prevProp)
.filter(([key, value]) => value !== this.props[key])
@hyzhak
hyzhak / TestCompareTwoArrays.as
Created June 8, 2012 12:37
Compare two arrays with same contents, but with different order in hamcrest-as.
import org.hamcrest.assertThat;
import org.hamcrest.collection.arrayWithSize;
import org.hamcrest.collection.everyItem;
import org.hamcrest.collection.inArray;
/**
* Compare two arrays with same contents, but with different order in hamcrest-as.
*
* Does anybody have more shorter version?
*/
@hyzhak
hyzhak / next-tick.js
Created November 30, 2018 23:45
next tick promise build which could be used when we need to wait before next portion of async calls
/**
* Create next trick promise which could be used:
*
* lazyAction()
* .then(nextTick())
* .then(doSomethingElse)
*
* @returns {Promise}
*/
module.exports = () => new Promise(resolve => process.nextTick(resolve))
@hyzhak
hyzhak / get-namespace.js
Created November 14, 2018 10:40
get current app redux namespace
import packageJSON from '../../package'
/**
* get current app namespace
*/
module.exports = function getReduxNamespace () {
return packageJSON.name
}
@hyzhak
hyzhak / perf.js
Created November 9, 2018 09:18
short but useful function to measure performance of function in node.js
function perf(fn) { console.time('x'); fn(); console.timeEnd('x');}
@hyzhak
hyzhak / show_samples.py
Last active November 8, 2018 10:08
Convert tensorflow dataset to pandas dataframe
import pandas as pd
import tensorflow as tf
def convert_tf_to_pd(ds, limit=32):
"""
Read data from Tensorflow dataset to Pandas dataframe
:param ds:
:param limit:
@hyzhak
hyzhak / links.md
Last active October 5, 2018 13:42
Awesome List of NASA Space Apps Challenge 2017
@hyzhak
hyzhak / binary.js
Last active September 13, 2018 22:57
limitations of binary operations in js
// Binary shifting
1 << 30
// 1073741824
1 << 31
// -2147483648
1 << 32
// 1
// Power
@hyzhak
hyzhak / Dockerfile
Created July 20, 2018 00:02
FoundationDB and Python3 together in the one Docker container
FROM foundationdb:ubuntu-18.04
# for the moment it is not published
# current version in preview here:
# https://github.com/apple/foundationdb/pull/355
ENV PATH /usr/local/bin:$PATH
# http://bugs.python.org/issue19846
# > At the moment, setting "LANG=C" on a Linux system *fundamentally breaks Python 3*, and that's not OK.
@hyzhak
hyzhak / setup-iss-ustream.sh
Last active February 15, 2017 15:41
Setup live streaming on Raspberry PI v1.0 for International Space Station (http://pressanykeytocreate.blogspot.com/2015/09/live-streaming-of-international-space.html)
#!/bin/bash
sudo apt-get update && sudo apt-get upgrade
sudo apt-get install rtmpdump python-pip
sudo pip install livestreamer
# to get best resolution
sudo apt-get install python-dev
sudo apt-get install libffi-dev
sudo apt-get install librtmp-dev