Skip to content

Instantly share code, notes, and snippets.

View efraintorlo's full-sized avatar
🤯
Learning in real world, I'll back later !

ETL efraintorlo

🤯
Learning in real world, I'll back later !
View GitHub Profile
@efraintorlo
efraintorlo / apache_mod_wsgi.makefile
Last active July 13, 2016 18:40
This Makefile is useful to:- Run, re-start and stop apache2 - Fixing a bug with MEDIA URLS in apache with mod_wsgi (pip-installed)
SHELL := /bin/bash
#-----------------------------------------------
# __ __ _ __ _ _
# | \/ | __ _| | _____ / _(_) | ___
# | |\/| |/ _ | |/ / _ \ |_| | |/ _ \
# | | | | (_| | < __/ _| | | __/
# |_| |_|\__,_|_|\_\___|_| |_|_|\___|
#
#-----------------------------------------------
# Makefile for APACHE2 + mod_wsgi
@efraintorlo
efraintorlo / Django_Gunicorn_Nginx.makefile
Last active December 13, 2016 15:46
Django with Gunicorn + Nginx
SHELL := /bin/bash
#-----------------------------------------------
# __ __ _ __ _ _
# | \/ | __ _| | _____ / _(_) | ___
# | |\/| |/ _ | |/ / _ \ |_| | |/ _ \
# | | | | (_| | < __/ _| | | __/
# |_| |_|\__,_|_|\_\___|_| |_|_|\___|
#
#-----------------------------------------------
# Makefile to use:
@efraintorlo
efraintorlo / odrive_status_zsh_theme.sh
Last active August 2, 2016 19:44
Odrive status for zsh
# check this ys.zsh-theme fork:
# https://github.com/elchinot7/dotfiles/blob/master/ys-modified-chinot7.zsh-theme
# This can be used to show the Odrive Sync status in Linux/OSX
# Add the line:
# ${odrive_info} \
# to the string PROMPT
# Odrive status
local odrive_info='$(ys_prompt_odrive)'
@efraintorlo
efraintorlo / volume_alias_linux.sh
Created August 16, 2016 05:18
Volume Up & Down from Terminal Aliases (Linux)
alias k='amixer -D pulse sset Master 10%+ |sed -n "s/.*\[\([^]]*\%\)\].*/Volume:\1/p" | head -1'
alias j='amixer -D pulse sset Master 10%- |sed -n "s/.*\[\([^]]*\%\)\].*/Volume:\1/p" | head -1'
alias kk='k && k'
alias jj='j && j'
@efraintorlo
efraintorlo / player_control.sh
Created August 16, 2016 05:21
Player control from Terminal (Aliases Linux)
alias pp="playerctl play-pause && playerctl metadata title"
alias pn="playerctl next && playerctl metadata title"
alias pb="playerctl previous && playerctl metadata title"
alias p+="playerctl volume"
alias pv="playerctl volume"
@efraintorlo
efraintorlo / latex_clean@SageMathCloud.py
Last active October 8, 2016 05:26
Clean the LaTeX output for functions and expressions in SageMathCloud. This can be used to dump latex in files or for show clean latex outputs inside sagews notebooks.
import re
def latex_clean(f):
_latex = re.sub('\\\\left\([{}\w\s\\\\,]+\s\\\\right\)\s\\\\\s\{\\\\mapsto\}\s\\\\\s', '', f._latex_())
return _latex
def show_clean(f):
_latex = r"$" + latex_clean(f) + "$"
show(_latex)
@efraintorlo
efraintorlo / Makefile_VIM_installer.makefile
Created December 25, 2016 17:35
VIM installer from git source.
SHELL := /bin/bash
#-----------------------------------------------
# __ __ _ __ _ _
# | \/ | __ _| | _____ / _(_) | ___
# | |\/| |/ _ | |/ / _ \ |_| | |/ _ \
# | | | | (_| | < __/ _| | | __/
# |_| |_|\__,_|_|\_\___|_| |_|_|\___|
#
#-----------------------------------------------
# VIM INSTALLER FROM SOURCE
@efraintorlo
efraintorlo / get_info_from_pdf_paper.py
Created February 20, 2017 02:47
Retrieve BibTeX info from PDF paper (it works if doi is included in the text)
from pyinspire import pyinspire
from PyPDF2 import PdfFileReader
import re
import sys
pdf_file = 'paper_from_prd.pdf' # local file
doi_re = re.compile('10.(\d)+/([^(\s\>\"\<)])+')
input = PdfFileReader(file(pdf_file, "rb"))
text = input.getPage(0).extractText()
@efraintorlo
efraintorlo / import_data_jupyter_azureML.py
Created July 13, 2017 15:11
Import dataset to Jupyter in Azure Machine Learning
from azureml import Workspace
ws = Workspace()
ds = ws.datasets['data.csv']
frame = ds.to_dataframe()
@efraintorlo
efraintorlo / is_preliminary_matplotlib.py
Created September 6, 2017 20:12
Add Text "Preliminary" to the Matplotlib figure's background
def is_preliminary(ax, color='0.5', alpha=0.4):
""" Add the 'Preliminary' legend into a plot
ax: Must be a matplotlib.axes._subplots.AxesSubplot
In practice ax is a Seaborn's plot.
"""
sizes = ax.figure.get_size_inches()
size = 6.0 * np.sqrt(sizes[0]**2.0 + sizes[1]**2.0)
ax.figure.text(0.5, 0.5, 'Preliminary',
fontsize=size, color=color,