Skip to content

Instantly share code, notes, and snippets.

View rg3915's full-sized avatar
🏠
Working from home

Regis Santos rg3915

🏠
Working from home
View GitHub Profile
@rg3915
rg3915 / .bash_aliases
Last active September 25, 2020 07:23
My bash_profile bash_aliases
alias l='clear; ls -lF'
alias ll='clear; ls -alF'
alias h=history
alias python=python3
### Short prompt
alias p='PS1="\${debian_chroot:+(\$debian_chroot)}\e[1;34m/\W\e[00m\[$txtcyn\]\$git_branch\[$txtred\]\$git_dirty\[$txtrst\]\$ "; clear'
# Git
@rg3915
rg3915 / core_tags.py
Created March 31, 2016 14:39
Return information in mouse over on html.
# /templatetags/core_tags.py
from django import template
from django.utils.safestring import mark_safe
register = template.Library()
@register.filter
def teste(value, arg):
@rg3915
rg3915 / ruby.md
Created June 21, 2016 01:26
Ruby Intro

Ruby intro

Objetos

#TUDO É OBJETO
puts 1.class # => Fixnun
puts "123".class  # => String
puts false.class  # => FalseClass
@rg3915
rg3915 / group_by_m2m.md
Created August 10, 2016 21:00
Group_by first item of M2M in Django
# views.py
def books_list(self):
    books_name = {}
    total = 0
    for item in Author.objects.all().order_by('books__name'):
        first_book = item.books.first()
        if first_book:
            total += 1
 books_name[first_book] = books_name.get(first_book, 0) + 1
@rg3915
rg3915 / gist:21b547711d65c8fae432f11104748ef2
Created August 23, 2016 16:42 — forked from edmondburnett/gist:40e7db34416fdc734846
Push-to-Deploy, Python edition - git post-receive hook script
#!/usr/bin/env python
# post-receive hook for git-based deployments
# https://edmondburnett.com/post/python-push-to-deploy
import sys
import os
from subprocess import call
# configuration
deploy_to_path = '/path/to/deploy/directory/'
@rg3915
rg3915 / dj-export-excel.py
Created September 2, 2016 20:44
Export data with django-excel
''' Exporta planilhas em Excel '''
from datetime import datetime
import django_excel as excel
from django.http import HttpResponseBadRequest
from .models import Person
MDATA = datetime.now().strftime('%Y-%m-%d')
def export_data_person(request, atype):
@rg3915
rg3915 / graph_models.sh
Last active September 18, 2016 20:29
How to generate graph models with Python 3
# Colors
red=`tput setaf 1`
green=`tput setaf 2`
reset=`tput sgr0`
sudo apt-get install graphviz libgraphviz-dev pkg-config
pip install pygraphviz
git clone https://github.com/nlhepler/pydot
cd pydot
python setup.py install
@rg3915
rg3915 / .vimrc
Last active January 3, 2017 23:51
my vimrc
set nocompatible " be iMproved, required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')
" let Vundle manage Vundle, required
@rg3915
rg3915 / pyenv_install.md
Last active July 9, 2021 02:33
pyenv install 2021
sudo apt-get install -y git make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev
curl -L https://raw.githubusercontent.com/yyuu/pyenv-installer/master/bin/pyenv-installer | bash

sudo vim ~/.bashrc

export PATH="$HOME/.pyenv/bin:$PATH"
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"
@rg3915
rg3915 / emmet_cheatsheet.md
Last active October 15, 2019 19:00
emmet commands

HTML

ul>lorem3#item$*10

p*5>lorem

table