Skip to content

Instantly share code, notes, and snippets.

View mehmetkose's full-sized avatar
:electron:
Reacting

Mehmet Kose mehmetkose

:electron:
Reacting
  • Sour Cream LTD
  • Dublin, Ireland
  • 17:54 (UTC +01:00)
  • X @mehmetkose
View GitHub Profile
@mehmetkose
mehmetkose / user.keymap
Created June 13, 2017 10:32
sublime text user key bindings
[
{ "keys": ["alt+f"], "command": "fold_function" }
]
@mehmetkose
mehmetkose / diplicity.conf
Created June 13, 2017 02:23 — forked from spamguy/diplicity.conf
An HTTPS reverse proxy configuration for Diplicity.
server {
listen 3000 ssl;
listen [::]:3000;
error_log /usr/local/var/log/nginx/error.log;
access_log /usr/local/var/log/nginx/access.log;
# Google DNS, Open DNS, Dyn DNS
resolver 8.8.8.8 8.8.4.4 208.67.222.222 208.67.220.220 216.146.35.35 216.146.36.36 valid=300s;
resolver_timeout 3s;
@mehmetkose
mehmetkose / dipl.io.conf
Created June 13, 2017 02:22 — forked from spamguy/dipl.io.conf
An nginx configuration featuring HTTP/2, IPv6, Let's Encrypt SSL, and a decent cipher suite
server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
server_name www.dipl.io dipl.io;
return 301 https://dipl.io$request_uri;
}
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
@mehmetkose
mehmetkose / mac_os_virtualenvwrapper_installer.sh
Last active May 29, 2017 14:50
bash script for virtualenvwrapper installer on mac os x
pip install virtualenv virtualenvwrapper
cp ~/.bash_profile ~/.bash_profile-org
printf '\n%s\n%s\n%s' '# virtualenv' 'export WORKON_HOME=~/virtualenvs' \
'source /usr/local/bin/virtualenvwrapper.sh' >> ~/.bash_profile
source ~/.bash_profile
mkdir -p $WORKON_HOME
@mehmetkose
mehmetkose / .bash_profile
Last active June 25, 2017 12:53
macos .bash_profile
if [ -f ~/.bashrc ]; then
source ~/.bashrc
fi
if [ -f ~/.bash_profile ]; then
source ~/.bash_profile
fi
@mehmetkose
mehmetkose / localhost.conf
Created December 30, 2016 18:09
nginx dev server conf
upstream appservers {
server 127.0.0.1:8888;
}
server {
server_name ~^www\.(?<domain>.+)\.dev ~^(?<domain>.+)\.dev$;
location / {
proxy_pass_header Server;
proxy_set_header Host $http_host;
proxy_redirect off;
@mehmetkose
mehmetkose / handlers.py
Created December 23, 2016 11:27 — forked from alejandrobernardis/handlers.py
Tornado, Download File
class AdminFileHandler(BaseHandler):
@authenticated
def get(self, file_name):
_file_dir = os.path.abspath("")+"/my/path/downloads"
_file_path = "%s/%s" % (_file_dir, file_name)
if not file_name or not os.path.exists(_file_path):
raise HTTPError(404)
self.set_header('Content-Type', 'application/force-download')
self.set_header('Content-Disposition', 'attachment; filename=%s' % file_name)
@mehmetkose
mehmetkose / python-kickstart.sh
Last active December 7, 2016 10:27
Python3 Development Stuff - Ubuntu 16.04
sudo apt-get update
sudo apt-get -y upgrade
sudo apt-get install -y vim
sudo apt-get install -y tmux
sudo apt-get install -y gcc
sudo apt-get install -y build-essential
sudo apt-get install -y python3-setuptools
@mehmetkose
mehmetkose / ws_app.py
Created November 30, 2016 16:27 — forked from kracekumar/ws_app.py
Simple websocket server with uvloop.
# -*- coding: utf-8 -*-
import asyncio
import uvloop
from aiohttp.web import Application, MsgType, WebSocketResponse
def add_socket(app, socket, user_id):
if user_id in app['connections']:
pass
@mehmetkose
mehmetkose / tornado_websocket_ee.py
Created November 29, 2016 09:27 — forked from gnpkrish/tornado_websocket_ee.py
Realtime Communicating with front-end using simple EventEmitter. With use of Tornado + Websocket.
"""
This is a simple example of WebSocket + Tornado + Simple EventEmitters usage.
Thanks to pyee by https://github.com/jesusabdullah
@Author:: Narayanaperumal G <gnperumal@gmail.com>
"""
import tornado.httpserver
import tornado.websocket
import tornado.ioloop
import tornado.web
from collections import defaultdict