Loosely ordered with the commands I use most towards the top. Sublime also offer full documentation.
| Ctrl+C | copy current line (if no selection) |
| Ctrl+X | cut current line (if no selection) |
| Ctrl+⇧+K | delete line |
| Ctrl+↩ | insert line after |
| #mehmetkose.org/linode-uzerinde-nginx-supervisord-tornado-yapilandirmasi.html | |
| import tornado.ioloop | |
| from tornado.options import define, options, logging | |
| import tornado.web | |
| define("port", default=8888, help="run on the given port", type=int) | |
| settings = { | |
| "debug": True, |
| #!/usr/bin/env python | |
| #Mehmet Kose 2012 - Popularity Algorithm | |
| from time import time | |
| simmdii = int(round(time() * 1000)) | |
| def rank (time,like,unlike,visit,comment): | |
| millis = int(round(time.time() * 1000)) | |
| return ( millis - time ) / ((like*2)-unlike)*(visit+comment) | |
| class UpdateHandler(tornado.websocket.WebSocketHandler,BaseHandler): | |
| #cache = [] | |
| brain = {} | |
| cache_size = 200 | |
| listenners = {} | |
| def allow_draft76(self): | |
| # for iOS 5.0 Safari | |
| return True |
| #!/usr/bin/env python | |
| #-*- coding:utf-8 -*- | |
| import random | |
| kuponsayisi = 40000 | |
| kuponlar = [] | |
| ii = 0 | |
| while ii < kuponsayisi: |
| cd ~ | |
| sudo apt-get update | |
| sudo apt-get install openjdk-7-jre-headless -y | |
| ### Check http://www.elasticsearch.org/download/ for latest version of ElasticSearch and replace wget link below | |
| # NEW WAY / EASY WAY | |
| wget https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-0.90.7.deb | |
| sudo dpkg -i elasticsearch-0.90.7.deb |
| import random | |
| macsayisi = 3 | |
| kuponsayisi = 600 | |
| ornekkupon = [[0,0], [0,0], [1, 0], [1, 1]] | |
| def skor_uret(): | |
| return random.randint(0,2) | |
| def kupon_uret(macsayisi): |
Loosely ordered with the commands I use most towards the top. Sublime also offer full documentation.
| Ctrl+C | copy current line (if no selection) |
| Ctrl+X | cut current line (if no selection) |
| Ctrl+⇧+K | delete line |
| Ctrl+↩ | insert line after |
| Install Ionic to dev android app on ubuntu 14.04 | |
| 0. Instal ubuntu-14.04-desktop-amd64.iso | |
| sudo apt-get update | |
| sudo apt-get install exfat-fuse exfat-utils | |
| sudo reboot | |
| 1. Copy jdk-7u60-linux-x64.tar.gz, apache-ant-1.9.4-bin.tar.gz to /opt and copy adt-bundle-linux-x86_64-20140321.zip to HOME/android | |
| cd /opt | |
| sudo tar zxvf jdk-7u60-linux-x64.tar.gz |
| import tornado.ioloop | |
| import tornado.web | |
| import logging | |
| import motor | |
| client = motor.MotorClient('mongodb://localhost:27017') | |
| db = client.test_database | |
| class MainHandler(tornado.web.RequestHandler): | |
| @tornado.web.asynchronous |
| class BaseHandler(tornado.web.RequestHandler): | |
| db = motor.MotorClient('mongodb://localhost:27017').mydb | |
| @tornado.gen.coroutine | |
| def get_group_names(self): | |
| user = yield self.db.user.find_one({'_id':ObjectId(self.current_user)}) | |
| raise tornado.gen.Return(user['groups']) | |
| class WebSocketHandler(tornado.websocket.WebSocketHandler, BaseHandler): | |
| def __init__(self, *args, **kwargs): |