Skip to content

Instantly share code, notes, and snippets.

from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import Column, Integer, String, create_engine
from sqlalchemy.orm import sessionmaker
Base = declarative_base()
class Info(Base):
__tablename__ = 'infos'
id = Column(Integer, primary_key=True)
keyword = Column(String, unique=True)
<lahwran> <__import__> [13:33:23] lahwran, someone is telling me if I bought MC in beta version, it's free updates till release, then you need to pay. Is this true?
<lahwran> they are incorrect
<lahwran> it doesn't matter when you buy minecraft; you get minecraft
<lahwran> if you bought in alpha, you bought minecraft /plus addons/
<lahwran> where addons = stuff created by mojang
<__import__> ok, so say mojang/notch updates the final client, what happens to beta buyers?
<lahwran> nothing
<lahwran> it updates as usual
<__import__> ok
<__import__> beta buyers won't get addons?
s = __import__("socket").socket()
s.connect(("irc.freenode.net", 6667))
s.send("NICK __import__\r\n")
s.send("USER __import__ irc.freenode.net bla :__import__\r\n")
readbuffer = ""
while True:
readbuffer += s.recv(1024)
temp = readbuffer.split("\n")
readbuffer = temp.pop()
for line in temp:
@EntityReborn
EntityReborn / AutoCompleter.py
Created July 23, 2011 17:53
AutoCompleting QLineEdit
from PyQt4.QtCore import QEvent, Qt
from PyQt4.QtGui import QLineEdit
class MyLineEdit(QLineEdit):
def __init__(self, *args, **kwargs):
QLineEdit.__init__(self, *args, **kwargs)
self.completions = [] # All available completions
self.partials = [] # Parsed completions according to partially typed word
groups:
Admins:
permissions:
- '*'
inheritance:
default: false
Moderators:
permissions:
- worldguard.region.removeowner.*
- worldedit.clipboard.*
print "__init__"
>>> pprint.pprint(server.api.call("getPlayers"))
[{u'health': 20,
u'inVehicle': False,
u'inventory': {u'armor': {u'boots': {u'amount': 0,
u'durability': -1,
u'type': 0},
u'chestplate': {u'amount': 0,
u'durability': -1,
u'type': 0},
u'helmet': {u'amount': 0,
conf = {
"/": {
"request.dispatch": cherrypy.dispatch.VirtualHost(**{
"x.co.cc": "/",
"y.x.co.cc": "/mc",
"static.x.co.cc": "/static"
}),
"tools.staticdir.root": r"/root/site/static",
},
"/static": {
>>> import cherrypy ; print cherrypy ; print cherrypy.dispatch
<module 'cherrypy' from 'C:\Python27\lib\site-packages\cherrypy\__init__.pyc'>
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'dispatch'
>>>
import cherrypy
from cherrypy import _cpserver
from cherrypy import _cpwsgi_server
secure_server = _cpwsgi_server.CPWSGIServer()
secure_server.bind_addr = ('0.0.0.0', 443)
secure_server.ssl_certificate = 'my_cert.crt'
secure_server.ssl_private_key = 'my_cert.key'
adapter = _cpserver.ServerAdapter(cherrypy.engine, secure_server, secure_server.bind_addr)
adapter.subscribe()