Skip to content

Instantly share code, notes, and snippets.

View htammen's full-sized avatar

Helmut Tammen htammen

View GitHub Profile
@htammen
htammen / cookieTest.js
Last active April 24, 2024 08:54
Simulation of OAuth authorization grant process flow
/**
* This litte program allows to test HTTP redirect cookie options.
* It can be used to simulate the OAuth authorization grant login process implemented
* by the german eID provider DTrust.
*
* How to use it?
* - start the application with `node cookieTest.js`. This starts a http server at Port 8000 at your localhost.
* - In another terminal window run ngrok with the command `ngrok http 8000`
* - you now can access your server via localhost:8000 and a ngrok https url.
* - Encode the ngrok url e.g. by node.js repl command `encodeURIComponent('https://ee3f-84-58-22-35.ngrok-free.app')`
@htammen
htammen / days.ts
Last active January 21, 2022 17:04
Calculates weekdays, sundays, saturdays and total days for a time period
/* run with 'deno days --help'
*/
import containedPeriodicValues from 'https://cdn.skypack.dev/contained-periodic-values';
import sugarDate from 'https://cdn.skypack.dev/sugar-date';
import { ld } from 'https://x.nest.land/deno-lodash@1.0.0/mod.ts'
import { parse } from "https://deno.land/std/flags/mod.ts"
/**
* returns a command line argument by name from the args array
*/
@htammen
htammen / holidays.ts
Created January 21, 2022 16:52
Returns holidays for a year, country and state. Many countries are supported
import dateHolidays from 'https://cdn.skypack.dev/date-holidays';
import { ld } from 'https://x.nest.land/deno-lodash@1.0.0/mod.ts'
import { parse } from "https://deno.land/std/flags/mod.ts"
/**
* returns a command line argument by name from the args array
*/
const getArg = function(argName: string, args: any[]): string {
//@ts-ignore
const arg = ld.find(args, (arg: string[]) => arg[0] === argName)
@htammen
htammen / cVimrc
Last active February 25, 2022 19:09
cVimrc settings
set noautofocus
# test
@htammen
htammen / btp_accesstoken
Last active November 24, 2021 07:38
Retrieve an access token for a btp cf app
#!/bin/bash
# Get BTP OAuth access token
# Usage:
# btp_accesstoken <appname>
#
# Call this bash script with btp_accesstoken <appname> where appname is a name
# of your apps on btp.
# You can retrieve the list of apps with 'cf a'
# Login credentials are retrieved from bitwarden. You have to be logged into it already
# client_id, client_secret, oauth endpoint are retrieved from 'cf de <appname>'. You have to be looged into it as well.

How to debug XSA application running on HXE

This readme describes how to debug an application that is deployed to a HXE instance of the HANA XSA.

  • xs enable-debugging fsdmds_ht-srv (This is an example. Enter the name of the app you want to debug. These can be found via xs a
  • In Chrome call chrome://inspect
  • Click "Open dedicated DevTools for Node"
  • Menu: Connection -> Choose 'Add connection' and enter 'localhost:'
@htammen
htammen / prjcrawler.ts
Last active February 16, 2021 22:32
A script to get a list of (open) project offers
// This script reads open projects and outputs them to the console.
// This is quite messy cause I created it at a sunday evening.
// Will hopefully find time in the future to make it a bit more production ready
import {
decode as base64Decode,
encode as base64Encode,
} from 'https://deno.land/std@0.82.0/encoding/base64.ts';
import { ld } from 'https://x.nest.land/deno-lodash@1.0.0/mod.ts'
import { parse } from "https://deno.land/std/flags/mod.ts"
Hi @petermuessig ,
wow, what a comprehensive answer! Thank you very much!!! These were exactly the pointers I was lacking.
Especially the mentioned Babel plugin is brilliant: It does the heavy lifting for using a modern syntax and still achieves backwards compatibility. And it plays well with your middleware (no surprise there :-)).
So I've tried to get this running and succeeded. My steps were:
adapt your livetranspile middleware to also search for ts files, not just js files. I'm planning on submitting a PR for your middleware soon. Also I haven't adapted the build task, but this shouldn't be too hard either.
wiring the new middleware in ui5.yaml
Install the essential babel plugins
@htammen
htammen / xsa login via bitwarden.md
Last active July 20, 2020 14:53
securely login via shell

Want to securely login to command line tools without exposing your credentials?

  • Install one of the Bitwarden clients (https://github.com/bitwarden)
  • Create your secure passwords with the Bitwarden client
    • Here I created a secure item with the namen xsa-engine
  • Install the Bitwarden CLI (https://github.com/bitwarden/cli)
  • At command line login to the Bitwarden CLI (bw login)
  • Write a script like the following to securely connect to your applications / servers. Here I connect to the HANA XSA server via xs client.
  • chmod 755 xsa_login.sh
@htammen
htammen / gist:b276475267d6af00e23de6b1cce218d5
Created September 11, 2019 07:07
UI5 Input control email validation
<Input id="email1"
value="{path: '/email1', type: 'sap.ui.model.type.String', constraints: {search: '^((?!\\.)[\\w-_.]*[^.])(@\\w+)(\\.\\w+(\\.\\w+)?[^.\\W])$'}}"
type="Email"
></Input>