Skip to content

Instantly share code, notes, and snippets.

@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 / 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 / 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 / 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 / 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 / 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 / encrypt-decrypt
Created February 22, 2019 09:41
Encryp and decrypt files in Linux with GPG
gpg -c file.txt
gpg -d file.txt.gpg
@dfbarrero
dfbarrero / tips.txt
Last active April 1, 2020 20:39
ConsoleTips
cd $_ # $_ is the last argument given to the last command
cd - # - is the last folder
# Intall Jupyter support for conda environments
conda install nb_conda
conda install ipykernel
@dfbarrero
dfbarrero / gpl3-licence-header.c
Created March 10, 2019 10:39
Template of C header file with the GNU General Public License v3.
/*
* {{ proyect }}
*
* Copyright (C) {{ year }} {{ Organization }}
*
* File created by {{ author }}.
*
* File modified by {{ contributor }}.
*
* This program is free software: you can redistribute it and/or modify
#!/usr/bin/env python
""" Short description of this Python module.
Longer description of this module.
This program is free software: you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
Foundation, either version 3 of the License, or (at your option) any later
version.