Skip to content

Instantly share code, notes, and snippets.

View holgergp's full-sized avatar

Holger Grosse-Plankermann holgergp

View GitHub Profile
@holgergp
holgergp / convertMovToGif.sh
Last active February 5, 2024 13:12
This is my little script to convert (screengrabbed-) movs to gifs to paste them into docs. This is just a tiny wrapper around ffmpeg and gifsicle. Obviously ffmpeg and gifsicle need to installed. I use ffmpeg version 6.6.1 and gifsicle in version 1.94
#!/bin/sh
while getopts f: flag
do
case "${flag}" in
f) inputFilename=${OPTARG};;
esac
done
ffmpeg -i $inputFilename.mov -pix_fmt rgb8 -r 10 $inputFilename.gif && gifsicle -O3 $inputFilename.gif -o $inputFilename.gif
@holgergp
holgergp / smartSmoothStep.ts
Last active October 12, 2023 14:34
Retrofitted SmoothStepPath to react-flow-smart-edge
import { SVGDrawFunction } from "@tisoap/react-flow-smart-edge/src/functions/drawSvgPath";
import { XYPosition } from "reactflow";
const distance = (a: XYPosition, b: XYPosition) => Math.sqrt(Math.pow(b.x - a.x, 2) + Math.pow(b.y - a.y, 2));
function getBend(a: XYPosition, b: XYPosition, c: XYPosition, size: number): string {
const bendSize = Math.min(distance(a, b) / 2, distance(b, c) / 2, size);
const { x, y } = b;
// no bend
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: Invocation of init method failed; nested exception is javax.persistence.PersistenceException: [PersistenceUnit: default] Unable to build Hibernate SessionFactory; nested exception is org.hibernate.exception.JDBCConnectionException: Unable to open JDBC Connection for DDL execution
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1804) ~[spring-beans-5.3.23.jar:5.3.23]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:620) ~[spring-beans-5.3.23.jar:5.3.23]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542) ~[spring-beans-5.3.23.jar:5.
@holgergp
holgergp / promiseAllNormal.ts
Created January 14, 2022 10:31
Promise.all() (TypeScript 4.5 article)
const result = await Promise.all([Promise.resolve(10), Promise.resolve(20)]);
@holgergp
holgergp / errorTS44.txt
Last active January 14, 2022 10:34
Awaited example from docs (TypeScript 4.5 article)
// Error!
//
// [number | Promise<100>, number | Promise<200>]
//
// is not assignable to type
//
// [number, number]
@holgergp
holgergp / awaitedInAction1.ts
Last active January 14, 2022 10:21
Tryout Awaited (TypeScript 4.5 Article)
let a: Promise<string>;
let b: Promise<Promise<string>>;
let c: Promise<Promise<Promise<string>>>
@holgergp
holgergp / firstAwaitedCode.ts
Created January 14, 2022 09:52
First Awaited Code (TypeScript 4.5 Article)
async function usingAwaitedAsAReturnType(): Awaited {
const result = await Promise.resolve(true)
return result;
}
@holgergp
holgergp / templateStringTypesAsDiscriminants.ts
Created January 14, 2022 09:50
Template String Types as Discriminants (TypeScript 4.5 Article)
export interface Success {
type: `${string}Success`;
body: string;
}
export function handler(r: Success | Error) {
if (r.type === "HttpSuccess") {
// (parameter) r: Success
const token = r.body;
}
@holgergp
holgergp / vueCode.ts
Last active January 14, 2022 09:48
Vue Code (TypeScript 4.5 Article)
<script setup>
import { someFunc } from "./some-module.js";
</script>
<button>Click me!</button>
@holgergp
holgergp / disableImportElision.ts
Created January 14, 2022 09:47
Disable Import Elision (TypeScript 4.5 Article)
import { Animal } from "./animal.js";
eval("console.log(new Animal().isDangerous())");