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
data-henrik / db2APItest.py
Created Aug 12, 2019
Simple Python-based test of the Db2 on Cloud REST API
View db2APItest.py
# Simple test of the Db2 on Cloud REST API
# Written by Henrik Loeser, hloeser@de.ibm.com
# https://cloud.ibm.com/apidocs/db2-on-cloud
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
data-henrik / README.md
Last active Nov 27, 2018
Pull data from a [Db2 or SQLAlchemy] database and inject into IBM Watson Discovery collection
View README.md

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
data-henrik / mywordcloud.py
Last active Oct 5, 2018
Python script to generate wordcloud for given background image
View mywordcloud.py
# 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
data-henrik / IBMCloud-AppID-OIDC-Flask.py
Created Jun 6, 2018
Use IBM Cloud App ID with OpenID Connect client in Python Flask app
View IBMCloud-AppID-OIDC-Flask.py
# for full example visit https://github.com/IBM-Cloud/github-traffic-stats/blob/master/backend/ghstats.py
# as part of this tutorial: https://console.bluemix.net/docs/tutorials/serverless-github-traffic-analytics.html
# 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
data-henrik / README.md
Last active Aug 29, 2015
Auto-respond to Twitter tweets and archive messages in DB2
View README.md

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
data-henrik / README.md
Created Oct 14, 2014
Use sipgate.io service to log phone calls in Cloudant and send out SMS via Twilio
View README.md
You can’t perform that action at this time.