Skip to content

Instantly share code, notes, and snippets.

View hibellm's full-sized avatar

Marcus hibellm

  • Roche
  • Basel
View GitHub Profile
@hibellm
hibellm / Logging to a web page
Created October 24, 2017 19:34 — forked from jhorneman/Logging to a web page
Some code snippets showing how one could send logging output to a web page in Python
# web_page_logger.py
import logging
class WebPageHandler(logging.Handler):
def __init__(self):
logging.Handler.__init__(self)
self.messages = []
def emit(self, record):
@hibellm
hibellm / RedisPythonPubSub1.py
Created April 14, 2018 21:53 — forked from jobliz/RedisPythonPubSub1.py
A short script exploring Redis pubsub functions in Python
import redis
import threading
class Listener(threading.Thread):
def __init__(self, r, channels):
threading.Thread.__init__(self)
self.redis = r
self.pubsub = self.redis.pubsub()
self.pubsub.subscribe(channels)
@hibellm
hibellm / flask_job_scheduler.py
Created June 22, 2019 07:49 — forked from ivanleoncz/flask_job_scheduler.py
Demonstrating APScheduler feature for small Flask App.
#!/usr/bin/python3
""" Demonstrating APScheduler feature for small Flask App. """
from apscheduler.schedulers.background import BackgroundScheduler
from flask import Flask
def sensor():
""" Function for test purposes. """
print("Scheduler is alive!")
@hibellm
hibellm / 01_Readme.md
Created July 9, 2019 07:11 — forked from Wildcarde/01_Readme.md
Quick demo embedding a Bokeh chart inside a Flask application

This works in a python 3.6 environment with bokeh and flask installed. To use this you need the following directory structure:

app/
 - templates/
   - hello.html
 - bokeh-slider.py
 - hello.py

After that you need to open two terminals at app/, in the first one you need to run the bokeh server with the command:

@hibellm
hibellm / 01-Learning-Python3.md
Created February 26, 2020 08:26 — forked from kenjyco/01-Learning-Python3.md
Learn Python 3 with Jupyter Notebook

Learning Python 3

This gist provides the learning-python3.ipynb notebook file, which can be viewed and edited in a Jupyter Notebook server to learn Python 3.

Once you load the notebook file to your local jupyter server, you can edit any

@hibellm
hibellm / brython.html
Created April 26, 2020 06:49 — forked from bradtraversy/brython.html
Python in the browser with Brython
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="https://cdnjs.cloudflare.com/ajax/libs/brython/3.8.8/brython.js" integrity="sha256-rA89wPrTJJQFWJaZveKW8jpdmC3t5F9rRkPyBjz8G04=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/brython/3.8.8/brython_stdlib.js" integrity="sha256-Gnrw9tIjrsXcZSCh/wos5Jrpn0bNVNFJuNJI9d71TDs=" crossorigin="anonymous"></script>