Skip to content

Instantly share code, notes, and snippets.

View sebastianrothbucher's full-sized avatar

Sebastian Rothbucher sebastianrothbucher

View GitHub Profile
@sebastianrothbucher
sebastianrothbucher / flow.json
Created August 3, 2024 18:01
Simulating a sine curve and sudden drop via Node-Red
[
{
"id": "91450f41b1eae9c6",
"type": "inject",
"z": "426169ba36026cef",
"name": "on",
"props": [
{
"p": "payload"
},
@sebastianrothbucher
sebastianrothbucher / gql-test.ts
Last active July 21, 2024 10:18
Base Apollo server (including subscriptions - can leave out ws part) - round trip
import {ApolloServer} from '@apollo/server';
import { ApolloServerPluginDrainHttpServer } from '@apollo/server/plugin/drainHttpServer';
import {expressMiddleware} from '@apollo/server/express4';
import {makeExecutableSchema} from '@graphql-tools/schema';
import express from 'express';
import cors from 'cors';
import morgan from 'morgan';
import fs from 'fs';
import {createServer} from 'http';
import { WebSocketServer } from 'ws';
@sebastianrothbucher
sebastianrothbucher / automator-shell.sh
Created June 11, 2024 13:05
img2txt - clipboard image to clipboard text
#!/bin/zsh
/opt/homebrew/bin/python3 /Users/s.rothbucher/tools/ocr/main.py | pbcopy
@sebastianrothbucher
sebastianrothbucher / shell-helper.inc
Created May 31, 2024 14:38
STS assume role and export creds - use via . shell-helper.inc in bash
function assumeRoleAndExport {
local STS_RES=$(aws sts assume-role --role-arn $1 --role-session-name "whatever-session-$(uuidgen)")
export AWS_ACCESS_KEY_ID=$(echo $STS_RES | jq -r .Credentials.AccessKeyId)
export AWS_SECRET_ACCESS_KEY=$(echo $STS_RES | jq -r .Credentials.SecretAccessKey)
export AWS_SESSION_TOKEN=$(echo $STS_RES | jq -r .Credentials.SessionToken)
}
@sebastianrothbucher
sebastianrothbucher / node-red-flows.json
Last active May 30, 2024 18:51
IoTcore simple policy and node-red flow
[
{
"id": "426169ba36026cef",
"type": "tab",
"label": "Flow 1",
"disabled": false,
"info": "",
"env": []
},
{
@sebastianrothbucher
sebastianrothbucher / index.html
Created March 31, 2024 18:59
pdf.js cont scroll
<div style="position: sticky; top: 0; background: white; ">Page <span id="page"></span> Timing: <span id="timing"></span></div>
<div id="canvases"></div>
I have the prod01 skates already - now can you get me more rolls for that?
@sebastianrothbucher
sebastianrothbucher / 01-schema.graphqls
Created November 12, 2023 11:09
Appsync dynamodb JS
type ItemsResponse {
listid: ID!
items: [ListItem]
}
type ListItem {
listid: ID!
ts_uuid: ID!
title: String!
done: Boolean!
@sebastianrothbucher
sebastianrothbucher / Application.java
Last active November 11, 2023 18:41
JAMstack with Keycloak and Boot
// ...
@Autowired
private JwtAuthFilter jwtAuthFilter;
@Bean
public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
http
.addFilterBefore(jwtAuthFilter, UsernamePasswordAuthenticationFilter.class)
// ...
return http.build();