Skip to content

Instantly share code, notes, and snippets.

@EliAndrewC
EliAndrewC / development.ini
Created May 22, 2020 00:15
Sideboard development.ini (for sideboard itself, not for the uber plugin) from my working dev environment
debug = False
priority_plugins = "uber",
[cherrypy]
engine.autoreload.on = False
server.socket_host = "127.0.0.1"
server.socket_port = 8282
server.socket_timeout = 1
server.thread_pool = 100
tools.proxy.debug = False
@EliAndrewC
EliAndrewC / development.ini
Created May 22, 2020 00:14
Working development.ini for the uber plugin from my dev environment
cherrypy_mount_path = "/reggie"
url_root = "https://%(hostname)s"
organization_name = "MAGFest INC"
event_year = 2020
event_name = "MAGFest"
event_timezone = "US/Eastern"
event_venue = "The Gaylord National Hotel and Convention Center"
event_venue_address = "201 Waterfront St, National Harbor, MD 20745"
send_emails = True
send_sms = False
/**
* This modules exports an Angular 2 WebSocketService implementing Sideboard's
* WebSocket RPC protocol. There are three main actions exposed to consumers:
* calling RPC methods, making subscriptions, and canceling subscriptions.
*
*
* Calling RPC Methods
* -------------------
* Consumers can make one-off RPC calls which return promises:
*
@EliAndrewC
EliAndrewC / ecards.py
Created November 22, 2016 21:02
Example of customized subscriptions
from collections import defaultdict
from sideboard.lib import notify, listify, threadlocal
__all__ = ['get', 'send']
ecards = defaultdict(list)
class user_subscribes(object):
@EliAndrewC
EliAndrewC / test_rwguard.py
Created November 22, 2016 18:13
Script to test the new sideboard.lib.RWGuard class
from __future__ import unicode_literals, print_function
import re
import random
import traceback
from functools import wraps
from datetime import datetime
from threading import Event, Thread, current_thread
from six.moves.queue import Queue, Empty
@EliAndrewC
EliAndrewC / infinite_redirect.py
Last active March 17, 2016 21:48
Example of CherryPy going into an infinite redirect loop
import cherrypy
class Root(object):
@cherrypy.expose
def index(self):
raise cherrypy.HTTPRedirect('/')
if __name__ == '__main__':
cherrypy.quickstart(Root())
@EliAndrewC
EliAndrewC / __init__.py
Last active September 5, 2015 04:28
Using Flask with Sideboard
"""
To use Flask with Sideboard, make a plugin and then put this file in the plugin
module's directory, e.g. sideboard/plugins/paper_bag/paper_bag/__init__.py and
the Flask site will be available at https://localhost:4443/uber/paper_bag
"""
import cherrypy
from cherrypy import wsgiserver
from flask import Flask
app = Flask(__name__)
@EliAndrewC
EliAndrewC / PerlHate
Last active August 29, 2015 14:24
What I dislike about Perl
My main problem with Perl is references and contexts. Most of the experienced programmers I've worked with find themselves unable to write or debug code that requires the use of these Perl concepts.
For example, my co-workers and I find it easy and intuitive to work with lists in Python:
xs = [5, 6]
xs.append(7)
print xs[2] # prints 7
xs.append([]) # easy to append lists to other lists
xs[3].append(6) # easy to append to the inner list
some_func(12, "hello", xs, True) # easy to pass to a function
# Current version:
def csv_file(func):
@wraps(func)
def csvout(self, session):
cherrypy.response.headers['Content-Type'] = 'application/csv'
cherrypy.response.headers['Content-Disposition'] = 'attachment; filename=' + func.__name__ + '.csv'
writer = StringIO()
func(self, csv.writer(writer), session)
return writer.getvalue().encode('utf-8')
@EliAndrewC
EliAndrewC / development.ini
Created April 26, 2015 04:49
Current development.ini on the test server
path = "/uber"
hostname = "50.56.242.7"
url_root = "http://50.56.242.7:8282"
dev_box = True
send_emails = False
collect_exact_birthdate = True
event_name = "MAGStock"
organization_name = "MAGStock"
groups_enabled = False