Skip to content

Instantly share code, notes, and snippets.

in progress

webus webus

in progress
Block or report user

Report or block webus

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
webus / Dockerfile
Created Aug 8, 2017
django / caddy / docker-compose
View Dockerfile
FROM python:3.5.3-onbuild
VOLUME ["/usr/src/app/staticfiles"]
CMD ["gunicorn", "--access-logfile", "-", "--error-logfile", "-", "-b", "", "app.wsgi", "-w", "4", "--preload"]
webus /
Created May 21, 2015
Interacting with MongoDB through Flask
# -*- coding: utf-8 -*-
from flask import request, session, redirect, url_for, render_template
from flask import Response
from flask import jsonify, make_response
from bson.json_util import dumps
from bson.objectid import ObjectId
from mobile import app, mongo, mongofs
from flask import Flask, request, redirect, url_for, make_response, abort
from werkzeug import secure_filename
from pymongo import Connection
from pymongo.objectid import ObjectId
from gridfs import GridFS
from gridfs.errors import NoFile
ALLOWED_EXTENSIONS = set(['txt', 'pdf', 'png', 'jpg', 'jpeg', 'gif'])
DB = Connection().gridfs_server_test
FS = GridFS(DB)
View thing.clj
(ns willwear.models.thing-model
(:require [ :as storage]))
(defn register-new-thing [session-token thing-tags thing-name thing-summary & {:keys [db] :or {db storage/willwear-db}}]
(let [user-uid (:user_uid (storage/check-user-session session-token :db db))]
(let [user-data (storage/get-user-by-uid user-uid :db db)]
(storage/add-new-thing user-uid thing-name thing-summary nil))))
View tmux-cheatsheet.markdown

tmux shortcuts & cheatsheet

start new:


start new with session name:

tmux new -s myname
View gist:6751899
# create stub, then run flask app in tornado on port 5000 (perhaps with supervisord config below
#!/usr/bin/env python
from tornado.wsgi import WSGIContainer
from tornado.httpserver import HTTPServer
from tornado.ioloop import IOLoop
from myflaskapp import app
http_server = HTTPServer(WSGIContainer(app))
webus / good_image_load.js
Created Sep 20, 2013
fine load images with jQuery
View good_image_load.js
jQuery.fn.loadComplete = function (fn) {
return this.each(function () {
if (this.complete || this.readyState == 'complete') {;
} else {
View nginx prestashop
server {
listen 80;
server_name MY.WEBSITE.TLD;
root /Users/ME/Sites/FOLDER;
client_header_buffer_size 16k;
large_client_header_buffers 16 16k;
# qsa
rewrite ^/api/?(.*)$ /webservice/dispatcher.php?url=$1 last;
You can’t perform that action at this time.