Skip to content

Instantly share code, notes, and snippets.

View nanounanue's full-sized avatar
💭
😡

Adolfo De Unánue nanounanue

💭
😡
View GitHub Profile

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

@nanounanue
nanounanue / UploadDirS3.py
Created January 17, 2018 04:52 — forked from feelinc/UploadDirS3.py
Upload folder contents to AWS S3
#!/usr/bin/python
import os
import sys
import boto3
# get an access token, local (from) directory, and S3 (to) directory
# from the command-line
local_directory, bucket, destination = sys.argv[1:4]
@nanounanue
nanounanue / gantt
Created December 15, 2017 17:30 — forked from t2ru/gantt
gantt chart using matplotlib
# -*- coding: utf-8 -*-
import datetime as dt
import numpy
import matplotlib
import matplotlib.pyplot as plt
import matplotlib.dates as md
import locale
from functools import reduce
locale.setlocale(locale.LC_ALL, "")
matplotlib.rcParams['font.family']='IPAPGothic'
@nanounanue
nanounanue / pandas.postgres.py
Created December 14, 2017 22:39 — forked from 00krishna/pandas.postgres.py
Connect from python pandas to a postgresql database and pull data.
import psycopg2 as pg
import pandas.io.sql as psql
# get connected to the database
connection = pg.connect("dbname=mydatabase user=postgres")
dataframe = psql.frame_query("SELECT * FROM <tablename>", connection)
@nanounanue
nanounanue / install_font_adobe_source_code_pro.sh
Created December 7, 2017 23:26 — forked from enzinier/install_font_adobe_source_code_pro.sh
Install font Adobe Source Code Pro on Ubuntu 16.04 LTS
#!/bin/sh
# Userland mode (~$USER/), (~/).
# ~/.fonts is now deprecated and that
#FONT_HOME=~/.fonts
# ~/.local/share/fonts should be used instead
FONT_HOME=~/.local/share/fonts
echo "installing fonts at $PWD to $FONT_HOME"
mkdir -p "$FONT_HOME/adobe-fonts/source-code-pro"
@nanounanue
nanounanue / r_ubuntu_17_10.sh
Created December 6, 2017 18:12 — forked from pachadotdev/r_ubuntu_17_10.sh
Install R on Ubuntu 17.10
# Install R
sudo apt-get update
sudo apt-get install gdebi libxml2-dev libssl-dev libcurl4-openssl-dev libopenblas-dev r-base r-base-dev
# Install RStudio
cd ~/Downloads
wget https://download1.rstudio.org/rstudio-xenial-1.1.383-amd64.deb
sudo gdebi rstudio-xenial-1.1.383-amd64.deb
printf '\nexport QT_STYLE_OVERRIDE=gtk\n' | sudo tee -a ~/.profile
@nanounanue
nanounanue / flask_logging.py
Created November 17, 2017 23:38 — forked from sysradium/flask_logging.py
Logging Flask errors to console to use it with docker and gunicorn
import logging
import flask
app = flask.Flask(__name__)
@app.before_first_request
def setup_logging():
if not app.debug:
# In production mode, add log handler to sys.stderr.
app.logger.addHandler(logging.StreamHandler())
@nanounanue
nanounanue / tscv.R
Created November 9, 2017 19:01 — forked from robjhyndman/tscv.R
Time series cross-validation diagrams
par(mar=c(0,0,0,0))
plot(0,0,xlim=c(0,28),ylim=c(0,1),
xaxt="n",yaxt="n",bty="n",xlab="",ylab="",type="n")
i <- 1
for(j in 1:20)
{
test <- (6+j):26
train <- 1:(5+j)
arrows(0,1-j/20,27,1-j/20,0.05)
points(train,rep(1-j/20,length(train)),pch=19,col="blue")
@nanounanue
nanounanue / batch.py
Created November 8, 2017 16:16 — forked from jfeala/batch.py
AWS Batch wrapper for Luigi
"""
AWS Batch wrapper for Luigi
From the AWS website:
AWS Batch enables you to run batch computing workloads on the AWS Cloud.
Batch computing is a common way for developers, scientists, and engineers
to access large amounts of compute resources, and AWS Batch removes the
undifferentiated heavy lifting of configuring and managing the required
@nanounanue
nanounanue / docker-cleanup-resources.md
Created September 25, 2017 19:38 — forked from bastman/docker-cleanup-resources.md
docker cleanup guide: containers, images, volumes, networks

Docker - How to cleanup (unused) resources

Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...

delete volumes

// see: https://github.com/chadoe/docker-cleanup-volumes

$ docker volume rm $(docker volume ls -qf dangling=true)

$ docker volume ls -qf dangling=true | xargs -r docker volume rm