Skip to content

Instantly share code, notes, and snippets.

View lukasbach's full-sized avatar
🦕

Lukas Bach lukasbach

🦕
View GitHub Profile
@lukasbach
lukasbach / blueprintbook.txt
Created October 28, 2024 22:05
Blueprints for generic item trains in Factorio Space Age
0eNrtfdtuY0eW5a8IehxQnhP3CGPcQHnQPWigC6guN9ADuA2BKVGZhJWimqLS5S7oA+Yv5mHmx+ZL5txIHkkRjLX2UaZdbttAioeXFRE7LnvHvv71/N3t4+p+u77bXb7bbH48//qvx3cezr/+fvLYfba+2twNbz+s398tb7v37pYfV+dfn2+X69vzp8X5+u569Zfzr9XTYvql3c/33Zc+rbe7x/adxf5Xj/cX2/X7D7uL5Xa7+Wnye/30w+J8dbdb79arocX+4efLu8eP71bbtoHFtOWLsanF+f3mof3N5q5rtcW5MCp+5RbnP7e/iP4r99T16wWUPkA97Fqwrjv9aHJgYYQKOSBzAHq3fn+xul1d7bbrq4v7ze0qC+ZOgVmiV+YUkBMML+WA/BHo4/L29uJ2+fE+i2IPFI95igcUydWQooBK2cElnkpJ5YBUw3epgKQEfTJZJC3oUx7JCPqUnTklWOAFJMEKT9mtorygT3mkACPpoE4iRcHosktcJcHoski6EYwuj3Rc41eP20+r6x7nYnkSKbZ84nq9bY/X/mPV5ID5U1032W2oDU22EpKlyVZCcoLRZTe09oLR5ZFCdirfZUd3RAKmMgrIlu9iolebbjTQRdMI5iN7mBklmI88kn4uIl19WK7vyoJSOycjs23xWmYLDNoI5iXfVSsgX14EcwLy5ZE8sZyPfXpGNpvDlWyTgEyHZJvkhy7ZJh7oopVskyzfsJJtkkfS8GBNow9Izwerc8DE9kgpD5xbQJbgIikQuI7AdQSuJ3ANgUuIWEkRuMQ+isy8JQKXmDdHCGORmDdHiGZRE7hyvpQgvuQkfCl7NjgBX1JZgc0J+FIBCedLpjn2qX5eucAzvJfA2fmOPMN71eHsPCd+nvM09Q3P8LouVbvolWABZUVXrwULKI9keIanDLCAvOUZ3kvg3ALyjmd4EK7nGR6EG3iGB+FGnuFBuIlneAhuaHiGB+EqnuFBuJpneBCukTI8ZSCGFwR6hfzZEAR6BZVX8dLaYt1
@lukasbach
lukasbach / code.js
Created February 23, 2023 01:42
Generate Github API Graphql Query for fetching all file contents in a repo
const owner = "lukasbach";
const repo = "react-complex-tree";
const branch = "main";
(async () => {
const trees = (await (await fetch(`https://api.github.com/repos/${owner}/${repo}/git/trees/${branch}?recursive=1`)).json()).tree;
const folders = trees.filter(i => i.type === "tree").map(i => i.path);
const queries = folders.map(folder => `
${folder.replace(/[^a-zA-Z0-9]/g, "_")}: object(expression: "${branch}:${folder}") {
... on Tree {
@lukasbach
lukasbach / deploy.yml
Created November 15, 2022 11:01
Thesis Deployment
name: Deploy PDF
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
workflow_dispatch:
@lukasbach
lukasbach / index.html
Last active October 11, 2022 10:04
Electron desktopCapturer.getSources demo. To reproduce, install Electron Fiddle (https://www.electronjs.org/fiddle) and load the gist there.
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<!-- https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP -->
<meta http-equiv="Content-Security-Policy" content="default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'">
<link href="./styles.css" rel="stylesheet">
<title>Hello World!</title>
</head>
<body>
@lukasbach
lukasbach / content.md
Created August 9, 2022 09:06
markdown example

Advertisement :)

  • pica - high quality and fast image resize in browser.
  • babelfish - developer friendly i18n with plurals support and easy syntax.

You will like those projects!

@lukasbach
lukasbach / recipes.ts
Last active March 23, 2022 21:49
TypeScript Advanced typing recipes
type Wrapper<T> = { wrapped: T };
type MapObject<T extends Record<keyof Object, any>> = {
[K in keyof T]: Wrapper<T[K]>;
};
type MapTuple<T extends [...any[]]> = {
[I in keyof T]: Wrapper<T[I]>;
} & { length: T["length"] };
@lukasbach
lukasbach / book
Created February 12, 2022 23:38
Factorio Modular Traingrid Blueprint Library
This file has been truncated, but you can view the full file.
0eNrMvVtvXcmSnftXCnoWjZn3zA34we6DAxiwAcMNAzYawgarxKpNbJYoU1R192ns/34WKV7mEjNXji9yabcfGt2t4hozMy55iYiM8W/vfr75evX57vrT/Z9/vr3967s//dvrv3x596d/+jfwBw//7fqX20/f/vnL9W+fLm8e/u3+Xz9fvfvTu+v7q9/fvX/36fL3h//v7vL65t3f3r+7/vTx6l/e/cn97f30J1/uL3/568Wv1zf3V3cX15++XN0d/o8dhv/bh/fvrj7dX99fX30bw+P/869//vT1958Pf/kn9wJ19S+f766+fLn4evjl3W93t4f/ffHz1c394WOfb78cAG4/PQzjABr+Q3r/7l/f/amU/5AOn/p4fXf1y7f/nN8/D/P26/3nr/fvHqbw3Rf9my/e311++vL59u5+8D0//l4HP6zMKFtmFO0zysqM0hv8L59vru8fNP0GOT4j1zluxuNOSBMF42eEX+34b+QeO/gN4xekV7cBxdZXwfSgLH7cBKu//jQweufB4J17UawgFosHu01YlMaTiUufNK0aLmHzcmwldHnhC5oFcxd3gX2hEjPLp52EO7SLaLR+419I7AsWR3dlxdM98vQKPN0HLq6GXMDHhS9oCuFu7Df2Be7G3rEvFKDhB6WdcDLPd2XPFh3fyGgTOBAF7r6+sMOp419gh6JAvPVhwid0Gbh/+spGGxe+IB3igsE/2QoQsmFJfjH5ajk7BL7vhuEHu1Kr9g80SWjNfmmSPhC5L8fhB3zvA85+fWp9f4veDlkloQT7laYOxhzttzBNzsk+5pGc+Y5aZ2LgHtmY6qp9zJqcm30GAzknw3HYoUEn03HYLS2+yS9dFqvhCJ7Cwk1uYLEpLmCOFJ4W7oOawvPCHW406rJwa9NGXRdGXaUvtIU5DCwkG9w3zzDdAuZAf9kv3YktDplXbq6jaazcVUfiNjgk2zay5fTr6tIKnMvCjXgk/bpwj9ck1RZGLS0CxXB/DRMLKm4BcyDr4hdiBJKsS1j
@lukasbach
lukasbach / reference.bib
Created April 1, 2021 15:05
t-Distribution Table LaTeX Code
@article{howell,
author = {Howell, D},
title = {{Fundamental Statistics For the Behavioral Sciences}},
year = {2008}
}
@lukasbach
lukasbach / formatTimeZoneOffset.ts
Created April 14, 2020 13:46
Format Timezone Offset
const formatTimeZoneOffset = (offset: number) => {
return (
(offset >= 0 ? '+' : '-') +
('0' + Math.floor(Math.abs(offset))).slice(-2) +
':' +
('0' + Math.round((Math.abs(offset) % 1) * 60)).slice(-2)
);
};
const removeDuplicates<T> = (arr: T[], equal: (a: T, b: T) => boolean) =>
arr.filter((item, pos) => arr.indexOf(arr.find(inner => equal(inner, item)) === pos));