Skip to content

Instantly share code, notes, and snippets.

View reinaldons's full-sized avatar
👾

Reinaldo Nolasco Sanches reinaldons

👾
View GitHub Profile
@reinaldons
reinaldons / .vimrc
Last active January 19, 2022 16:04
My VIM as Python IDE
set nocompatible
filetype off
set dir=~/.vim/tmp//
" Alias
nnoremap <C-Left> :bp<CR>
nnoremap <C-Right> :bn<CR>
" Colors
syntax enable
@reinaldons
reinaldons / .bashrc
Last active September 2, 2016 12:08
Append for Kubuntu .bashrc
# autoenv
. /usr/local/bin/activate.sh
. /usr/share/virtualenvwrapper/virtualenvwrapper.sh
. ~/.bash_prompt
export GOROOT=/usr/lib/go-1.6
export PATH=$PATH:$GOROOT/bin
@reinaldons
reinaldons / .bash_prompt
Created September 2, 2016 11:46
git + python virtualenv bash PROMPT_COMMAND
#!/bin/bash
#
# DESCRIPTION:
#
# Set the bash prompt according to:
# * the active virtualenv
# * the branch of the current git/mercurial repository
# * the return value of the previous command
# * the fact you just came from Windows and are used to having newlines in
# your prompts.

Keybase proof

I hereby claim:

  • I am reinaldons on github.
  • I am reinaldons (https://keybase.io/reinaldons) on keybase.
  • I have a public key whose fingerprint is 5902 BA8F 5386 C10A 8E02 7A52 0AE9 1492 F02C D42C

To claim this, I am signing this object:

Verifying that +reinaldons is my blockchain ID. https://onename.com/reinaldons
import urllib
import requests
# OAuth2 Server URL
URL = 'https://oauth2.server'
# URL to redirect after login
REDIRECT_URI = 'https://redirect.url'
# Client ID and Secret Key
CLIENT_ID = ''
@reinaldons
reinaldons / sms-gw-json-to-csv.py
Created October 30, 2015 16:08
Load a JSON generated by SMS-GW API /api/v1/products/(product_name)/messages and wwriting a CSV file with some fields
import json
import csv
from optparse import OptionParser
def json_to_csv(json_filename, csv_filename):
with open(json_filename, 'r') as json_file:
json_decoded = json.load(json_file)
with open(csv_filename, 'w') as csv_file:
@reinaldons
reinaldons / Makefile
Last active June 15, 2020 13:47
Flask + uWSGI + Nginx
PID_FILE = '/tmp/flask_test_uwsgi.pid'
LOG_FILE = '/tmp/flask_test_uwsgi.log'
up:
uwsgi --ini uwsgi.ini --wsgi-file app.py --pidfile $(PID_FILE) --logto $(LOG_FILE) &
down:
uwsgi --stop $(PID_FILE)
@reinaldons
reinaldons / views.py
Last active May 9, 2021 01:55
Create CSV on-the-fly with Flask, stream_with_context and SQLAlchemy using generator
from datetime import datetime
from flask import current_app, stream_with_context, Response
from flask_blueprint_acquisition import current_blueprint
from sqlalchemy.sql import compiler
from .blueprints import base_blueprint
from .models import Acquisition, Package, Product, User
import json
with open('json file path') as f:
json_data = json.load(f)
json_data[0]['key'] = 'new value'
print(json.dumps(json_data))