Skip to content

Instantly share code, notes, and snippets.

View ourway's full-sized avatar
🏆

Farshid Ashouri ourway

🏆
View GitHub Profile
@ourway
ourway / falcon_gevent_streaming.py
Created October 17, 2015 01:27 — forked from sebasmagri/falcon_gevent_streaming.py
Concurrently streaming response using Falcon and Gevent
# Fire this using gunicorn falcon_gevent_streaming
# and head to 127.0.0.1:8000 in a browser.
# Requirements:
# pip install falcon gevent
import falcon
import gevent
from gevent.queue import Queue
@ourway
ourway / main.py
Created October 17, 2015 01:29 — forked from rynangeles/main.py
Simple Falcon REST API for angularJS SPA demo.
#!/usr/bin/env python
import os
import json
import falcon
import mimetypes
from wsgiref import simple_server
from pymongo import MongoClient
from bson.objectid import ObjectId
from bson.json_util import dumps
@ourway
ourway / falcon_middleware_cors.py
Created October 17, 2015 01:30 — forked from lbenitez000/cors.py
A CORS middleware for the Falcon Framework <http://falconframework.org/>
""" A CORS middleware for the Falcon Framework <http://falconframework.org/>
"""
__author__ = "Luis Benitez"
__license__ = "MIT"
from falcon import HTTP_METHODS
class CorsMiddleware(object):
"""Implements (partially) the Cross Origin Resource Sharing specification
@ourway
ourway / gist:33e9777224126e0f4684
Created October 17, 2015 01:32 — forked from kgriffs/gist:ef6a51b9f419fe3444dc
Delete unused Docker images, but leave anything named in place.
docker rmi $(docker images -q -f dangling=true)
@ourway
ourway / gist:4203e30fa8a3504ca920
Created October 17, 2015 01:38 — forked from kgriffs/gist:b4eb14c91212f2fa3a0a
SQLAlchemySessionManager (B)
# =========================================================================
# middleware.py
# =========================================================================
import sqlalchemy.orm.scoping as scoping
class SQLAlchemySessionManager(object):
def __init__(self, session_factory, auto_commit=False):
self._session_factory = session_factory
self._scoped = isinstance(session_factory, scoping.ScopedSession)
@ourway
ourway / be-professional.md
Created October 17, 2015 01:41 — forked from kgriffs/be-professional.md
Be Professional

Do This

  • Act professionally
  • Treat others as friends and family
  • Seek first to understand
  • Respect other's opinions though they may differ from your own
  • Admit when you're wrong
  • Be honest, transparent, and constructive
  • Use clear, concise language
@ourway
ourway / nginx-sec.conf
Created October 17, 2015 01:45 — forked from kgriffs/nginx-sec.conf
nginx security
# See also http://arstechnica.com/gadgets/2012/11/how-to-set-up-a-safe-and-secure-web-server/4/
server_tokens off;
client_max_body_size 4096k;
client_header_timeout 10;
client_body_timeout 10;
keepalive_timeout 10 10;
send_timeout 10;
@ourway
ourway / nginx-gzip.conf
Created October 17, 2015 01:46 — forked from kgriffs/nginx-gzip.conf
nginx gzip
# See also: http://arstechnica.com/gadgets/2012/11/how-to-set-up-a-safe-and-secure-web-server/3/
gzip on;
gzip_disable "msie6";
gzip_min_length 1100;
gzip_vary on;
gzip_proxied any;
gzip_buffers 16 8k;
gzip_types text/plain text/css application/json application/x-javascript
@ourway
ourway / sysctl.conf
Created October 17, 2015 01:47 — forked from kgriffs/sysctl.conf
Linux Web Server Kernel Tuning
# Configuration file for runtime kernel parameters.
# See sysctl.conf(5) for more information.
# See also http://www.nateware.com/linux-network-tuning-for-2013.html for
# an explanation about some of these parameters, and instructions for
# a few other tweaks outside this file.
# Protection from SYN flood attack.
net.ipv4.tcp_syncookies = 1
@ourway
ourway / Nginx proxy_pass
Created October 29, 2015 13:09 — forked from skorotkiewicz/Nginx proxy_pass
Nginx proxy_pass
server {
# listen 66.225.195.83;
server_name synchtube.itunix.eu;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
location / {
proxy_pass http://synchtube.itunix.eu:1337;
proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504;
proxy_redirect off;