Skip to content

Instantly share code, notes, and snippets.

Mike Escalante mcescalante

Block or report user

Report or block mcescalante

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
# Select those values, get them to be json
c.execute('select * from data')
data = c.fetchall()
print data
# Data will print: [(u'{"test": "test2"}',)]
# To load the JSON for python use
for item in data:
print json.loads(item[0])
# Data will print: {u'test': u'test2'}
import sqlite3
import json
conn = sqlite3.connect('test.db')
c = conn.cursor()
# Insert {'test':'test2'} dummy values into database
c.execute('''insert into data values(?)''',(json.dumps({'test':'test2'}),))
mcescalante /
Last active Sep 18, 2019
import sqlite3
import json
conn = sqlite3.connect('test.db')
c = conn.cursor()
# Insert values
c.execute('''insert into data values(?)''', (json.dumps({'test':'test2'}),))

Keybase proof

I hereby claim:

  • I am mcescalante on github.
  • I am mcescalante ( on keybase.
  • I have a public key whose fingerprint is 59F6 7311 E003 5EBE 4A0C D3C3 238D 8F30 A94E F114

To claim this, I am signing this object:

mcescalante / .tmux.conf
Created Nov 8, 2016
My OSX/macOS tmux configuration, tested on 10.11.x
View .tmux.conf
#allow mousing
set -g mouse-utf8 on
set -g mouse on
# Return pre-2.1 mousing behaviour
bind -n WheelUpPane if-shell -F -t = "#{mouse_any_flag}" "send-keys -M" "if -Ft= '#{pane_in_mode}' 'send-keys -M' 'select-pane -t=; copy-mode -e; send-keys -M'"
bind -n WheelDownPane select-pane -t= \; send-keys -M
# Use vim keybindings in copy mode
mcescalante /
Last active Sep 9, 2018
Run a Flask application with gunicorn and nginx

This guide assumes:

  • You have a VPS (something like DigitalOcean, Linode, etc.)
  • You have a Flask application and a basic understanding of command line instructions
  • You've got nginx installed and know where your configuration files are


  1. First, you should install gunicorn on your box or virtualenv with pip:
mcescalante /
Last active Nov 13, 2017
cx_Oracle installation instructions/notes for macOS or Linux

cx_Oracle Installation Instructions

I've had to put cx_Oracle (python Oracle database connector) on macOS and Linux, and both processes were similar but poorly documented on Oracle's website.

These instructions were written and tested using the client 12.1. The instructions for any 12.x are the same, but you may need to change 12_1 to 12_2 in commands if you are using version 12.2, etc.


  1. Download 64 bit (easy to download 32 by mistake) basic + sdk instantclient from Oracle website (Note: you need an account, I used throwaway email)
mcescalante / lolcomment.css
Created Feb 24, 2015
funny css file comment
View lolcomment.css
TODO: Rewrite this from scratch
TODO: Use this code as an example of how not to code:
- no comments
- nondescript var names
- inline html generation
- inline css generation
- not keeping a reference to DOM elements
- browser checks
- code quadruplication (I've never actually seen that before)
mcescalante / formMacro.html
Created Jan 29, 2015
jinja macro for rendering form field errors
View formMacro.html
{% macro with_errors(field) %}
<div class="form_field">
{% if field.errors %}
{% set css_class = 'has_error ' + kwargs.pop('class', '') %}
{{ field(class=css_class, **kwargs) }}
<ul class="errors">{% for error in field.errors %}<li>{{ error|e }}</li>{% endfor %}</ul>
{% else %}
{{ field(**kwargs) }}
{% endif %}
#sometimes helpful when reconfiguring /etc/hosts to point locally and browsers are using a cached copy
dscacheutil -flushcache
You can’t perform that action at this time.