Skip to content

Instantly share code, notes, and snippets.

@dfbarrero
dfbarrero / notasKeras.txt
Last active October 15, 2018 12:00
Instalación del entorno para ejecutar Keras
# Docker
Orden para arrancar Jupyter desde la imagen docker oficial de TensorFlow con acceso a un difectorio del host:
docker run -it -p 8888:8888 -v $(pwd):/home/pantalla/david/notebooks/ -w /home/pantalla/david/notebooks/ tensorflow/tensorflow
o bien
docker run -it --rm -p 8888:8888 -v $(pwd):/home/pantalla/david/notebooks/ -w /home/pantalla/david/notebooks/ jupyter/tensorflow-notebook
# Conda
@dfbarrero
dfbarrero / UMN_students-2011.csv
Last active August 10, 2018 11:57
Dataset with students weight, hight, sex and race seen in https://www.reddit.com/r/datasets/comments/460fc5/students_weight_sexheight_and_race/, available in http://psych.umn.edu/~XXXXX/data/UMN_students-2011.csv. The original file has been modified to avoid Gist errors.
id weight height sex race
1 143.598135188032 80.6382204460964 Female White
2 109.094416743981 83.7366504377381 Female Black
3 148.560463194675 63.2674171329737 Female Hisp
4 104.881118603777 54.6625706634309 Female Hisp
5 141.527107821507 81.1471863960098 Female Black
6 124.598800037726 20.5511008074068 Female Hisp
7 130.209847885546 81.7524637767098 Male White
8 176.902741065031 59.0953973693696 Female Black
9 126.799167717638 58.8960064014157 Male White
@dfbarrero
dfbarrero / density.R
Created November 22, 2017 18:23
R script that uses Lattice to plot a Choropleth map.
#!/usr/bin/Rscript --vanilla
library(sp)
#library(RColorBrewer)
colorPalette <- colorRampPalette(c("white", "orange"))(32)
spain <- readRDS("ESP_adm1.rds")
# Datos de Informe Anual del Sector TIC y de los Contenidos en España 2016. ONTSI
@dfbarrero
dfbarrero / plotTwoFunctions.tex
Last active May 12, 2017 18:33
Example of two overlapped plots in LaTeX/Tikz.
\documentclass{article}
\usepackage{tikz}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
xlabel=$x$,
@dfbarrero
dfbarrero / plotFunction.tex
Last active May 12, 2017 18:27
Example of how to graph a symbolic expression with LaTeX and Tikz
\documentclass{article}
\usepackage{tikz}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
xlabel=$x$,
ylabel={$g(x) = \frac{1}{1+e^{-x}}$}
@dfbarrero
dfbarrero / graph.tex
Created March 23, 2017 09:55
Graph figure with LaTeX/Tikz
\begin{tikzpicture}
\tikzstyle{node_style} = [circle,draw=black]
\tikzstyle{edge_style} = [draw=black]
\node[node_style] (v1) at (-2,2) {2};
\node[node_style] (v2) at (2,2) {3};
\node[node_style] (v3) at (4,0) {6};
\node[node_style] (v4) at (2,-2) {4};
\node[node_style] (v5) at (-2,-2) {5};
\node[node_style] (v6) at (-4,0) {1};
\draw[edge_style] (v1) edge (v2);
@dfbarrero
dfbarrero / tree.tex
Created March 23, 2017 09:54
Tree figure with LaTeX/Tikz
\begin{tikzpicture}[level distance=1.3cm,
level 1/.style={sibling distance=3cm, level distance=1cm},
level 2/.style={sibling distance=1.5cm, level distance=0.8cm}]
\node {Root}
child {node {Child}
child {node {Node}}
child {node {Node}}
}
child {node {Level 2}
child {node {Level 3}}
@dfbarrero
dfbarrero / hastable.tex
Last active March 23, 2017 10:44
Hash table figure with LaTeX/Tikz
\begin{tikzpicture} [nodes={minimum width=0.8cm, minimum height=0.8cm},
row sep=-\pgflinewidth, column sep=-\pgflinewidth]
\matrix (hash)[matrix of nodes, nodes={draw, anchor=center}]
{
Key1 & Value1 \\
Key2 & Value2 \\
Key3 & Value3 \\
};
\end{tikzpicture}
@dfbarrero
dfbarrero / list.tex
Created March 23, 2017 09:52
Linked list figure with LaTeX/Tikz
\begin{tikzpicture}[draw, minimum width=1cm, minimum height=0.5cm]
\node[draw] (in) at (-1,2) {};
\node[draw] (out) at (1,-2) {};
\matrix (queue)[matrix of nodes, nodes={draw, nodes={draw}}, nodes in empty cells]
{
\\ \\ \\ \\
};
\draw[-latex] (0.25,-1) .. controls (0.25,-1.25) and (1,-1.25) .. (out.north);
\draw[-latex] (in.south) .. controls (-1, 1.5) and (-0.25,1.5) .. (-0.25,1);
@dfbarrero
dfbarrero / queue.tex
Created March 23, 2017 09:50
Queue figure with LaTeX/Tikz
\begin{tikzpicture}[draw, minimum width=1cm, minimum height=0.5cm]
\node[draw] (in) at (-1,2) {};
\node[draw] (out) at (1,-2) {};
\matrix (queue)[matrix of nodes, nodes={draw, nodes={draw}}, nodes in empty cells]
{
\\ \\ \\ \\
};
\draw[-latex] (0.25,-1) .. controls (0.25,-1.25) and (1,-1.25) .. (out.north);
\draw[-latex] (in.south) .. controls (-1, 1.5) and (-0.25,1.5) .. (-0.25,1);