Skip to content

Instantly share code, notes, and snippets.

@simonrw
simonrw / python_pymysql_notes.md
Created September 18, 2015 19:01
Notes about pymysql connections

Database transactions

pymysql

  • Defaults to autocommit=False
connection = pymysql.connect(user='user', db='test')
cursor = connection.cursor()
cursor.execute('insert into test (value) values (10)')
@TheWaWaR
TheWaWaR / gunicorn_service.py
Last active October 5, 2023 12:54
Gunicorn service script {Start | Restart | Stop | Reload | Quit}
#!/usr/bin/env python
#coding: utf-8
import os
import imp
import time
import signal
import argparse
import commands
@ryanmcgrath
ryanmcgrath / load_proper.js
Created January 5, 2011 22:16
How to properly branch loading of JS
/* Since script loading is dynamic, we take
a callback function with our loadScript call
that executes once the script is done downloading/parsing
on the page.
*/
var loadScript = function(src, callbackfn) {
var newScript = document.createElement("script");
newScript.type = "text/javascript";
newScript.setAttribute("async", "true");
newScript.setAttribute("src", src);