Skip to content

Instantly share code, notes, and snippets.

View u0078867's full-sized avatar

Davide Monari u0078867

View GitHub Profile
@u0078867
u0078867 / gist:5286ed4cd510f43a0fa8
Last active February 15, 2016 06:53
Recursively cloning React children inside DOM tags
var RecursiveChildComponent = React.createClass({
render() {
return <div>
{this.recursiveCloneChildren(this.props.children)}
</div>
},
recursiveCloneChildren(children) {
return React.Children.map(children, child => {
var childProps = {};
if (React.isValidElement(child)) {
@u0078867
u0078867 / gist:9df30eb7da64d8f43422faa70b1a9e52
Last active May 24, 2016 09:18
Make implementation of Arduino WiFi101 (v0.8.0) WiFiClient.write() method non blocking (but data-loss)
// For file src/WiFiClient.cpp change ths method:
size_t WiFiClient::write(const uint8_t *buf, size_t size)
{
sint16 err;
if (_socket < 0 || size == 0) {
setWriteError();
return 0;
}
@u0078867
u0078867 / gist:a5400ab50c0a71cbbca32981cc965d3d
Last active November 22, 2016 12:43
Python converters from SymPy math expression to C code optimized for speed (SymPy CSE, GCC -Ofast)
from sympy import Symbol cse, ccode
from sympy.utilities import numbered_symbols
# Inspired by http://stackoverflow.com/questions/22665990/optimize-code-generated-by-sympy
def sympyToC(symname, symfunc):
tmpsyms = numbered_symbols("tmp")
symbols, simple = cse(symfunc, symbols=tmpsyms)
symbolslist = map(lambda x:str(x), list(symfunc.atoms(Symbol)) )
symbolslist.sort()
@u0078867
u0078867 / tvd2dcm_v1.bat
Created November 8, 2017 07:51
Convert Telemed TVD files to DICOM cine
:: works only with version 3.4.3+
@ECHO OFF
FOR %%f IN (.\inputs\*.tvd) DO (
echo converting %%f ...
EchoWave %%f -minimize -save_cine dcm_jpeg outputs\%%~nf.dcm -exit
)
echo done!