Skip to content

Instantly share code, notes, and snippets.

Henrik Loeser data-henrik

Block or report user

Report or block data-henrik

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
data-henrik /
Created Aug 12, 2019
Simple Python-based test of the Db2 on Cloud REST API
# Simple test of the Db2 on Cloud REST API
# Written by Henrik Loeser,
import requests, json, sys, time
# Read credentials from file
def readCreds(filename):
with open(filename) as data_file:
credentials = json.load(data_file)
return credentials
data-henrik /
Last active Nov 27, 2018
Pull data from a [Db2 or SQLAlchemy] database and inject into IBM Watson Discovery collection

From database into Watson Discovery

The code shown is a simple Python example of pulling data from a SQL database supported by SQLAlchemy, and then injecting the data as new JSON document into a collection of Watson Discovery Service on IBM Cloud.

data-henrik /
Last active Oct 5, 2018
Python script to generate wordcloud for given background image
# Masked wordcloud
# ================
# Using a mask you can generate wordclouds in arbitrary shapes.
import sys, getopt
from os import path
from PIL import Image
import numpy as np
import random
import matplotlib.pyplot as plt
data-henrik /
Created Jun 6, 2018
Use IBM Cloud App ID with OpenID Connect client in Python Flask app
# for full example visit
# as part of this tutorial:
# import all kinds of modules
# this one is needed for the OIDC client
from flask_pyoidc.flask_pyoidc import OIDCAuthentication
# initialize Flask, etc.
data-henrik /
Last active Aug 29, 2015
Auto-respond to Twitter tweets and archive messages in DB2

Flow to automatically respond to tweets in Twitter. If the tag "archive" is used, then the incoming tweet is stored in the DB2-based sqldb service. A simple Web service is provided to retrieve the archived tweets from DB2.

To work, the table "twitarchive" needs to be created.

create table twitarchive(
id int generated always as identity,
tstamp timestamp,
tweet varchar(200),
username varchar(100)
data-henrik /
Created Oct 14, 2014
Use service to log phone calls in Cloudant and send out SMS via Twilio
You can’t perform that action at this time.