Skip to content

Instantly share code, notes, and snippets.

@kaiserama
kaiserama / README.md
Created August 25, 2017 13:27 — forked from oodavid/README.md
Backup MySQL to Amazon S3

Backup MySQL to Amazon S3

This is a simple way to backup your MySQL tables to Amazon S3 for a nightly backup - this is all to be done on your server :-)

Sister Document - Restore MySQL from Amazon S3 - read that next

1 - Install s3cmd

this is for Centos 5.6, see http://s3tools.org/repositories for other systems like ubuntu etc

@kaiserama
kaiserama / README.md
Created August 25, 2017 13:27 — forked from oodavid/README.md
Restore MySQL from Amazon S3

Restore MySQL from Amazon S3

This is a hands-on way to pull down a set of MySQL dumps from Amazon S3 and restore your database with it

Sister Document - Backup MySQL to Amazon S3 - read that first

1 - Set your MySQL password and S3 bucket, make a temp dir, get a list of snapshots

# Set our variables

export mysqlpass="ROOTPASSWORD"

@kaiserama
kaiserama / charge.test.html
Last active November 24, 2021 06:54
Flask + Stripe Connect
<h1>
Test Charges
</h1>
<p>Your credit card will charged later.</p>
<form action="{{ url_for('charge_test') }}" id="pay_form" class="pull-right" method="post">
<script src="https://checkout.stripe.com/v2/checkout.js" class="stripe-button" data-key="{{ key }}" data-name="Application Name Here" data-description="Test Reservation" data-amount="5000"></script>
</form>
@kaiserama
kaiserama / gist:11398525
Last active August 29, 2015 14:00
Flask-Login + Principal Basic
class LoginForm(Form):
email = TextField('Email', validators=[Required()])
password = PasswordField('Password', validators=[Required()])
remember = BooleanField('Remember Me', default=True)
class UserRole(db.Model):
__tablename__ = 'user_role'
id = db.Column('user_role_id', db.Integer, primary_key=True)
user_id = db.Column(db.Integer, db.ForeignKey('user.user_id'))
@kaiserama
kaiserama / DataTables.py
Last active March 16, 2022 14:52
Jquery DataTables class implementation in Flask with MySQL. There was an example of using DataTables with MongoDB + Flask, but nothing for using MySQL + Flask. Be sure you install Flask-MySQL extension first!
from MySQLdb import cursors
from flask import request
class DataTablesServer(object):
def __init__( self, request, columns, index, table, cursor):
self.columns = columns
self.index = index
self.table = table
# values specified by the datatable for filtering, sorting, paging