Skip to content

Instantly share code, notes, and snippets.

View defnull's full-sized avatar

Marcel Hellkamp defnull

View GitHub Profile
@defnull
defnull / bbb-cluster-notes.md
Created April 4, 2023 11:20
Ansible cluster setup for BBB

How To deploy an anible-role-bigbluebutton cluster with the Proxy Setup

Configuration per BBB node

bbb_lbmode:
  # Loadbalancer domain name (e.g. example.com)
  host: "{{ bbblb_domain }}"
  # Node name (e.g. bbb01, defaults to subdomain)
  name: "{{ bbb_nodename | default(inventory_hostname.split('.')[0]) }}"
@defnull
defnull / bbb-broadcast.py
Last active April 21, 2023 18:20
Admin tool to send chat messags to running BBB meetings
#!/usr/bin/env python3
import sys, json, subprocess, time, argparse
"""
Admin tool to send chat messages to running BBB meetings by directly injecting events into the REDIS channel.
This can be used for example to broadcast a maintenance warning message before shuttinng down a server.
Tested with BBB 2.5
Copyright 2022 Marcel Hellkamp
License: MIT
'''
For a tree of nested lists with integer leaves, calculate the sum of all leaves.
'''
def recurse(root):
# Slow because it creates a lot of lists (generators are even slower)
return sum([child if isinstance(child, int) else recurse(child) for child in root])
def recurse2(root):
# Faster because less intermediate objects are created.
Verifying I am +defnull on my passcard. https://onename.com/defnull
@defnull
defnull / dl.py
Created October 4, 2012 21:27
Easiest way to download bottle
wget http://bottlepy.org/bottle.py
curl http://bottlepy.org/bottle.py > bottle.py
pip install bottle
easy_install bottle
python -c 'import urllib; open("bottle.py", "wb").write(urllib.urlopen("http://bottlepy.org/bottle.py").read())'
python3 -c 'import urllib.request; open("bottle.py", "wb").write(urllib.request.urlopen("http://bottlepy.org/bottle.py").read())'
@defnull
defnull / example.py
Created March 13, 2012 20:52
Bottle ResourceManager Preview
from bottle import Bottle
app = Bottle()
# Resource configuration (relative to current file)
app.resources.add_path('./data/', base=__file__)
# Override default resources with files in test directory
app.resources.add_path('/home/marc/dev/test_data/', index=0)
@defnull
defnull / example.py
Created February 11, 2012 21:54
Bottle templates example
import bottle
app = bottle.Bottle()
# Template configuration
app.views.adapter = Jinja2Adapter
app.views.options['extensions'] = ['jinja2.ext.i18n']
app.views.globals['some_variable'] = 'some_value'
app.views.add_path('templates/', root=__file__)
# Shortcut to render templates directly.
@defnull
defnull / tcping.py
Created December 4, 2011 21:11
TCPing
def ping(server, port):
''' Check if a server accepts connections on a specific TCP port '''
try:
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((server, port))
s.close()
return True
except socket.error:
return False
@defnull
defnull / gist:1224387
Created September 17, 2011 21:22
Deploy a Bottle app on Heroku
mkdir heroku
cd heroku/
virtualenv --no-site-packages env
source env/bin/activate
pip install bottle gevent
pip freeze > requirements.txt
cat >app.py <<EOF
import bottle
import os
@defnull
defnull / gist:1216497
Created September 14, 2011 13:06
Subclassable ViewPlugin
class ViewPlugin(object):
''' Automatically renders a template for callbacks that return a dictionary.
Subclasses may overrule some methods to implement engine specific
features. They must implement :meth:`prepare_file` and
:meth:`prepare_source`, should implement :meth:`prepare_factory` and may
implement :meth:`assemble_config`, :meth:`is_source`, :meth:`locate` and
additional methods.
'''