Skip to content

Instantly share code, notes, and snippets.

View MrMikeFloyd's full-sized avatar
🦄
living, learning, coding.

Maik Fleuter MrMikeFloyd

🦄
living, learning, coding.
  • Munich, DE
View GitHub Profile
@MrMikeFloyd
MrMikeFloyd / local.settings.json
Last active February 22, 2018 14:35
Minimal C# Azure Function with an inbound table storage binding, resulting in "Microsoft.Azure.WebJobs.Host: Can't bind Table to type 'System.Linq.IQueryable`1[test.TableRow]'". Created on macOS High Sierra with Visual Studio Code 1.19.3 and .NET Core 2.0.5
{
"IsEncrypted": false,
"Values": {
"AzureWebJobsStorage": "DefaultEndpointsProtocol=https;AccountName=xxxxxxx;AccountKey=xxxxxxxxxxxxxx",
"AzureWebJobsDashboard": ""
}
}
@MrMikeFloyd
MrMikeFloyd / HttpTrigger.cs
Last active January 17, 2021 22:00
Sample for binding an Azure Function (v2) to an external Table Storage using CloudTable instead of IQueryable. Tested on Visual Studio Code 1.19.3 and .NET Core 2.0.5 on macOS.
using System.IO;
using Microsoft.Azure.WebJobs;
using Microsoft.Azure.WebJobs.Extensions.Http;
using Microsoft.AspNetCore.Http;
using Microsoft.Azure.WebJobs.Host;
using Newtonsoft.Json;
using System;
using Microsoft.WindowsAzure.Storage.Table;
using System.Collections.Generic;
using System.Net.Http;
@MrMikeFloyd
MrMikeFloyd / deploy.cmd
Last active February 27, 2018 12:04
Deployment script for Azure Function deployed via GitHub. Deployment fails with 'Input file does not exist: D:\home\site\repository\undefined.'
@if "%SCM_TRACE_LEVEL%" NEQ "4" @echo off
:: ----------------------
:: KUDU Deployment Script
:: Version: 1.0.15
:: ----------------------
:: Prerequisites
:: -------------
@MrMikeFloyd
MrMikeFloyd / EAR package structure
Last active January 8, 2020 12:10
Sample setup/WebSphere Liberty logs during application startup when deploying KoSIT Validator as an EAR.
C:.
| kositvalidator-api.war
|
+---lib
| kositvalidator-logic-0.0.1.0.jar
| validationtool-1.1.0.jar
| ...other jars omitted for brevity
|
\---META-INF
application.xml
@MrMikeFloyd
MrMikeFloyd / JSF TabPanel example
Created December 9, 2019 10:30
Example for creating a JSTL-loop-powered Tabpanel
<rich:tabPanel width="50px">
<c:forEach items=#{_myTabs}" var="_myTab" varStatus="currPos">
<rich:tab switchType="client" label="Tab ${currPos.index}">
.
.
.
</c:forEach>
</rich:tabPanel>
@MrMikeFloyd
MrMikeFloyd / ackermann.pl
Created December 26, 2019 11:00
Implementation for the infamous Ackermann Function in SWI-Prolog
%
% Ackermann function
% ackermann(X,Y,R)
%Base cases
ackermann(0,0,R) :- R is 1.
ackermann(0,Y,R) :- Y>0, !, R is Y+1. %Stop if Y=0
%Cases leading to recursion
ackermann(X,0,R) :-
X>0, !, %Cut, if X=0
@MrMikeFloyd
MrMikeFloyd / PermutationsFinder.java
Created January 8, 2020 12:05
A little Java command line program that finds all permutations for a given String using recursive calls.
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
class PermutationsFinder {
public static void main(String[] args) throws IOException {
String input;
ArrayList<String> permutations = new ArrayList<>();
@MrMikeFloyd
MrMikeFloyd / order-app-jhipster-jdl.jh
Created May 26, 2020 12:25
jHipster JDL for a sample order management microservice app.
application {
config {
baseName webStore
applicationType gateway
serverPort 9042
authenticationType oauth2
packageName de.maik.store.web
searchEngine elasticsearch
serviceDiscoveryType eureka
testFrameworks [protractor]
@MrMikeFloyd
MrMikeFloyd / Dockerfile
Last active February 4, 2021 08:22
Dockerfile for a minimal Ubuntu instance containing a number of LDAP client utilities that allows SSH login and X11 forwarding.
FROM ubuntu:latest
ENV DEBIAN_FRONTEND=noninteractive
RUN apt update && apt install sudo vim inetutils-ping traceroute curl xbase-clients x11-apps openssh-server jxplorer ldapvi ldap-utils -y
RUN useradd -rm -d /home/ubuntu -s /bin/bash -g root -G sudo -u 1000 ldapuser
RUN echo 'ldapuser:ldappwd' | chpasswd
RUN echo 'X11UseLocalhost no' >> /etc/ssh/sshd_config
RUN echo 'AddressFamily inet' >> /etc/ssh/sshd_config
RUN service ssh start
@MrMikeFloyd
MrMikeFloyd / graphql-to-s3-lambda.py
Last active June 29, 2021 13:07
Sample AWS Lambda (Python) to authenticate against a GraphQL db, printing the result, and storing the query duration in a S3 bucket. The credentials are taken from SSM parameter store. In order to make external libraries such as requests available at execution time, these need to be packaged beforehand (using virtualenv and the like).
import json
import urllib.parse
import boto3
import requests
import time
import datetime
ALBUM_ID = "REPLACE_ME_ALBUM_ID"
S3_BUCKET = "REPLACE_ME_BUCKET_NAME"
S3_KEY = "REPLACE_ME_BUCKET_OBJECT_NAME"