Skip to content

Instantly share code, notes, and snippets.

View jonico's full-sized avatar
🚀
@ home

Johannes Nicolai jonico

🚀
@ home
View GitHub Profile
@jonico
jonico / index.js
Last active September 20, 2022 11:44
How to debug PlanetScale database-js API with a proxy hooked into node-js 18's fetch API (based on undici)
import { connect } from '@planetscale/database'
import dotenv from 'dotenv'
import express from 'express'
import { ProxyAgent } from 'undici';
const agent = new ProxyAgent('http://localhost:5555');
global[Symbol.for('undici.globalDispatcher.1')] = agent;
process.env['NODE_TLS_REJECT_UNAUTHORIZED'] = '0';
@jonico
jonico / Jenkinsfile
Last active September 3, 2024 00:13
Jenkinsfile showing advanced Postman CLI, portman (contract test generation) and newman integration including custom reporters and reporting status back to Postman
def checkout () {
context="continuous-integration/jenkins/"
context += isPRMergeBuild()?"pr-merge/checkout":"branch/checkout"
def scmVars = checkout scm
setBuildStatus ("${context}", 'Checking out completed', 'SUCCESS')
if (isPRMergeBuild()) {
prMergeRef = "refs/pull/${getPRNumber()}/merge"
mergeCommit=sh(returnStdout: true, script: "git show-ref ${prMergeRef} | cut -f 1 -d' '")
echo "Merge commit: ${mergeCommit}"
return [prMergeRef, mergeCommit]
@jonico
jonico / postman-issue-ops.yml
Created June 20, 2023 13:44
GitHub Action based IssueOps workflow to create Postman releases and a tag directly from a pull request by issuing a comment starting with /pm-release [<release-name>] ["release notes"]
name: Postman IssueOps commands
on:
issue_comment:
types: [created]
jobs:
prechecks:
name: Permission pre-check
if: github.event.issue.pull_request != null && (startsWith(github.event.comment.body, '/pm-release') || startsWith(github.event.comment.body, '/pm-publish'))
@jonico
jonico / modify-examples.js
Created December 12, 2023 14:39
Duplicate Postman collection responses
var fs = require('fs'), // needed to read JSON file from disk
Collection = require('postman-collection').Collection,
Response = require('postman-collection').Response,
myCollection;
// Load a collection to memory from a JSON file on disk (say, sample-collection.json)
myCollection = new Collection(JSON.parse(fs.readFileSync('sample-collection.json').toString()));
// iterate through all requests in the collection
myCollection.forEachItem(function (item) {
@jonico
jonico / challenges.md
Last active February 15, 2025 00:51
AI Coding-Platform Evaluation

AI Coding platform evaluation

Warming up: Make some fun music with suno.ai and don't time out for longer song texts

We love to generate our custom AI music with Postman and suno.ai and this repository is a nice API wrapper around suno.ai's functionalities. However, generating longer songs takes time and makes the custom_generate API call timeout in synchronous mode. We would like to make the endpoint wait up to 60 s when hosted in Vercel. The Vercel documentation on how to configure custom timeouts in the vercel.json file can be found here: https://vercel.com/docs/functions/configuring-functions/duration. The API calls to give the 60 s timeout to are defined in src/app/api/custom_generate/route.ts. Please propose the necessary changes to the repository.

Bonus: Can you create a Postman collection that is making use of the custom_generate API endpoint to create a beautiful pop song about automated code generation, contains a Postman visualization for the resulti

@jonico
jonico / index.ts
Last active June 22, 2024 22:44
Backstage 1.25 with Postman plugin
/*
* Hi!
*
* Note that this is an EXAMPLE Backstage backend. Please check the README.
*
* Happy hacking!
*/
import { createBackend } from '@backstage/backend-defaults';
import { loggerToWinstonLogger } from '@backstage/backend-common';