Navigation Menu

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 / Real time access with kyma workloads.md
Last active April 21, 2024 11:45
Real time access with kyma workloads
@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>
@ptesny
ptesny / tcpproxy.js
Created September 6, 2021 20:57 — forked from kfox/tcpproxy.js
A basic TCP proxy written in node.js
var net = require("net");
process.on("uncaughtException", function(error) {
console.error(error);
});
if (process.argv.length != 5) {
console.log("usage: %s <localport> <remotehost> <remoteport>", process.argv[1]);
process.exit();
}
<repositories>
<repository>
<id>redhat-ga-repository</id>
<name>Red Hat GA repository</name>
<url>http://maven.repository.redhat.com/ga/</url>
<releases>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
</releases>
<snapshots>
@ptesny
ptesny / OAuthClient.xsjslib
Created April 3, 2021 21:52 — forked from scanacs-agruhn/OAuthClient.xsjslib
OAuth2.0 Client for XSJS Classic with Client Credentials Grant Flow
/* OAuth Client for HANA XS - Runtime processing for HANA Base DU
*
* Provide the following functionality:
* - get authorize URI
* - exchange authorization code for access token (authorization code flow)
* - get access token by providing SAML assertion (SAML bearer flow)
* - enrich application request by access token
* - refresh flow
* - revoke token(s)
*
@ptesny
ptesny / iframe.html
Created March 7, 2021 15:31 — forked from cirocosta/iframe.html
Sending messages from child iframe to parent webpage
<!DOCTYPE html>
<html>
<head>
<title>My Iframe</title>
</head>
<body>
<button>Botão</button>
<script type="text/javascript">