Skip to content

Instantly share code, notes, and snippets.

View ptesny's full-sized avatar

Piotr Tesny ptesny

  • SAP UK Ltd
  • London
View GitHub Profile
@ptesny
ptesny / kube-secret-to-file.sh
Created July 7, 2024 08:40 — forked from welshstew/kube-secret-to-file.sh
use jq to pull base 64 things out of a secret and construct them to file
#pull a base64 encoded files out of a kubernetes json secret
oc get secrets/broker-client-secret -o json | jq -r '.data."client.ts"' | base64 -d > client.ts
oc get secrets/broker-server-secret -o json | jq -r '.data."broker.ks"' | base64 -d > broker.ks
oc get secrets/broker-server-secret -o json | jq -r '.data."broker.ts"' | base64 -d > broker.ts
#replace base64 content in a secret - and save to file
THINGY=$(base64 newbroker.ks)
oc get secrets/il3-broker-server-secret -o json | jq -r --arg THINGY $THINGY '.data."broker.ks" = $THINGY' > my-new-secret.json
@ptesny
ptesny / SAP Cloud Management service.md
Last active May 20, 2024 07:50
SAP BTP easy peasy lemon squeezy with BTP core services.
@ptesny
ptesny / Real time access with kyma workloads.md
Last active April 21, 2024 11:45
Real time access with kyma workloads
@ptesny
ptesny / Expose and secure kyma workloads with client certificates and kyma-system defined mTLS gateways.md
Last active May 4, 2024 08:22
Expose and secure kyma workloads with client certificates and kyma-system defined mTLS gateways

2. Expose and secure kyma workloads with client certificates and kyma-system defined mTLS gateways

The following kyma tutorial details a number of pre-requisite steps, namely:
  • having a dedicated custom domain for mTLS communication with a mutual TLS gateway
  • and creating a cacert bundle for the server side certificate validation.
However, any managed kyma cluster domain is also a custom domain (and managed by SAP).

Thus, it is possible to reuse this kyma cluster domain "as is" by adding a dedicated mutual TLS gateway.

@ptesny
ptesny / mTLS gateways with custom business domains.md
Last active May 4, 2024 08:21
Mutual TLS easy with SAP BTP, Kyma runtime and BTP destinations

2.2 mTLS gateways with custom business domains

Let's opt for a dedicated DNS entry for the purpose of mTLS communications, namely:

apiVersion: dns.gardener.cloud/v1alpha1
kind: DNSEntry
metadata:
 annotations:
@ptesny
ptesny / token-generator.js
Created May 30, 2022 12:00 — forked from ziluvatar/token-generator.js
Example of refreshing tokens with jwt
/**
* Example to refresh tokens using https://github.com/auth0/node-jsonwebtoken
* It was requested to be introduced at as part of the jsonwebtoken library,
* since we feel it does not add too much value but it will add code to mantain
* we won't include it.
*
* I create this gist just to help those who want to auto-refresh JWTs.
*/
const jwt = require('jsonwebtoken');
@ptesny
ptesny / client.js
Created May 24, 2022 11:25 — forked from abtris/client.js
Connect to Postgres/Redshift over Socks proxy.
var pg = require('pg'),
url = require('url'),
SocksConnection = require('socksjs');
var db = url.parse(process.env.REDSHIFT_CONN_STRING),
dbAuth = db.auth,
dbUsername = dbAuth.split(':')[0],
dbPassword = dbAuth.split(':')[1],
dbName = db.pathname.replace('/', '');
@ptesny
ptesny / download-file.js
Created March 11, 2022 23:56 — forked from javilobo8/download-file.js
Download files with AJAX (axios)
axios({
url: 'http://localhost:5000/static/example.pdf',
method: 'GET',
responseType: 'blob', // important
}).then((response) => {
const url = window.URL.createObjectURL(new Blob([response.data]));
const link = document.createElement('a');
link.href = url;
link.setAttribute('download', 'file.pdf');
document.body.appendChild(link);
@ptesny
ptesny / download-file.js
Created March 11, 2022 23:53 — forked from Tomassito/download-file.js
Download files with AJAX (axios)
axios({
url: 'http://localhost:5000/static/example.pdf',
method: 'GET',
responseType: 'blob', // important
}).then((response) => {
const url = window.URL.createObjectURL(new Blob([response.data]));
const link = document.createElement('a');
link.href = url;
link.setAttribute('download', 'file.pdf');
link.click();
@ptesny
ptesny / parent.html
Created March 1, 2022 12:41 — forked from tarun/parent.html
testing setting timeouts in postMessage callback in the parent window. this seems to break on mobile browsers (tested in iOS 5/6). posting message to the same window works fine.
<!DOCTYPE html>
<html>
<head>
<title>iOS background setTimeout test - parent</title>
</head>
<body>
<h1>Parent</h1>
<button id="open-popup">Open Popup</button>