Skip to content

Instantly share code, notes, and snippets.

:octocat:
in progress

webus webus

:octocat:
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
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", "0.0.0.0:8000", "app.wsgi", "-w", "4", "--preload"]
EXPOSE 8000
@webus
webus / api_v1_map.py
Created May 21, 2015
Interacting with MongoDB through Flask
View api_v1_map.py
# -*- 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
View yandex_email_for_domain_settings.py
EMAIL_HOST = 'smtp.yandex.ru'
EMAIL_HOST_USER = 'login@example.com'
EMAIL_HOST_PASSWORD = 'password'
EMAIL_PORT = 465
EMAIL_USE_TLS = True
View simple_gridfs_server.py
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 [willwear.storage.db.ww-storage :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:

tmux

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 http://supervisord.org/index.html)
#!/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
webus / good_image_load.js
Created Sep 20, 2013
fine load images with jQuery
View good_image_load.js
//function
jQuery.fn.loadComplete = function (fn) {
return this.each(function () {
if (this.complete || this.readyState == 'complete') {
fn.call(this);
} else {
$(this).load(fn);
}
});
};
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.