Skip to content

Instantly share code, notes, and snippets.

View kretes's full-sized avatar

Tomasz Bartczak kretes

View GitHub Profile
def check(sysEnvKey: String, execute: () => Unit) = sys.env.keys.find(_ == sysEnvKey).foreach(a => execute())
"env" should {
"be printes" in {
check("JAVA_HOME",() => println("exists"))
}
}
def check(sysEnvKey: String, execute: () => Unit) =
sys.env.keys.find(_ == sysEnvKey).foreach(a => execute())
"env" should {
"be printes" in {
check("JAVA_HOME",() => println("exists"))
}
}
Seq(1,2,3).scan(0)(_ + _).tail must beEqualTo(Seq(1,3,6))
@kretes
kretes / motion.ino
Created January 21, 2015 21:01
Spark core firmware for simple publishing motion events
int sensorPin = D1;
int LED = D7;
void blink(int times) {
for(int i=0;i<times;i++) {
digitalWrite(LED, HIGH);
delay(100);
digitalWrite(LED, LOW);
delay(100);
}
@kretes
kretes / motion-tinker.ino
Created January 22, 2015 21:15
Spark core for publishing motion + controling them over tinker app
int sensorPin = D1;
int LED = D7;
int IN=D2;
int tinkerDigitalRead(String pin);
int tinkerDigitalWrite(String command);
int tinkerAnalogRead(String pin);
int tinkerAnalogWrite(String command);
void setup()
@kretes
kretes / Dockerfile-working
Created September 17, 2016 07:06
minimal installation of keras 1.0.8 running example code at the end
FROM nvidia/cuda:7.5-cudnn5-devel
ENV CONDA_DIR /opt/conda
ENV PATH $CONDA_DIR/bin:$PATH
RUN mkdir -p $CONDA_DIR && \
echo export PATH=$CONDA_DIR/bin:'$PATH' > /etc/profile.d/conda.sh && \
apt-get update && \
apt-get install -y wget git libhdf5-dev g++ graphviz && \
wget --quiet https://repo.continuum.io/miniconda/Miniconda3-3.9.1-Linux-x86_64.sh && \
@kretes
kretes / Dockerfile-failing
Created September 17, 2016 07:08
minimal installation of keras at some new revision running example code at the end
FROM nvidia/cuda:7.5-cudnn5-devel
ENV CONDA_DIR /opt/conda
ENV PATH $CONDA_DIR/bin:$PATH
RUN mkdir -p $CONDA_DIR && \
echo export PATH=$CONDA_DIR/bin:'$PATH' > /etc/profile.d/conda.sh && \
apt-get update && \
apt-get install -y wget git libhdf5-dev g++ graphviz && \
wget --quiet https://repo.continuum.io/miniconda/Miniconda3-3.9.1-Linux-x86_64.sh && \
@kretes
kretes / get_gpi_from_wiki.ipynb
Created November 14, 2016 09:39
Script to get Global Peace Index (GPI) data from WIkipedia as pandas DF
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@kretes
kretes / Dockerfile
Last active November 15, 2016 20:51
This is a minimal docker file to run quiver https://github.com/jakebian/quiver
FROM continuumio/miniconda
RUN pip install https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.11.0-cp27-none-linux_x86_64.whl
RUN pip install h5py
RUN apt-get install -y git
RUN git clone https://github.com/jakebian/quiver.git
@kretes
kretes / README.md
Last active December 6, 2016 21:13
christmas lights scheduler on particle

I used particle core http://particle.io and a relay module http://allegro.pl/show_item.php?item=6573707747 to turn the lights on/off. Relay is needed because you cannot get more than 3,3V from particle core pin and you shouldn't puch much current through it anyway.

The module has a bit surprising API, but thanks to https://community.particle.io/t/switch-relay-by-connecting-pin-to-ground/9077/27 I could use it succesfully.

Christmas lights (in my case 4,5V) are wired to the relay, relay IN is connected to pin D6 on particle and that's it.