Skip to content

Instantly share code, notes, and snippets.

View liesislukas's full-sized avatar
🚀
Excited

Lukas Liesis liesislukas

🚀
Excited
View GitHub Profile
@liesislukas
liesislukas / Caddyfile
Created March 18, 2024 07:19 — forked from lopezjurip/Caddyfile
Fix Too Many Redirect error using Caddy + Cloudflare
www.mysite.com, mysite.com {
proxy / webapp:3000 {
proxy_header Host {host}
proxy_header X-Real-IP {remote}
proxy_header X-Forwarded-Proto {scheme}
}
gzip
tls your@email.com
}
@liesislukas
liesislukas / index.js
Created January 28, 2022 14:58
Framer component to zip
const fs = require("fs");
const path = require("path");
const del = require("del");
const util = require("util");
const exec = util.promisify(require("child_process").exec);
const readFile = util.promisify(fs.readFile);
const writeOutput = require("./writeOutput");
const express = require("express");
const axios = require("axios");
const app = express();
@liesislukas
liesislukas / index_item.js
Created December 9, 2021 11:34
opensearch_sample_codes
var AWS = require('aws-sdk');
var region = 'us-east-1'; // e.g. us-west-1
var domain = 'search-boringgrowth-production-i6qoaz4c44rfxl25pkiwtvwgvm.us-east-1.es.amazonaws.com'; // e.g. search-domain.region.es.amazonaws.com
var index = 'lukas';
var type = '_doc';
var id = '1';
var json = {
@liesislukas
liesislukas / plambda.yaml
Created September 29, 2021 05:53 — forked from sihil/plambda.yaml
Snippet of some CloudFormation resources for Plambda
API:
Type: AWS::ApiGateway::RestApi
Properties:
Name:
Fn::Join:
- " "
- - Restorer Plambda
- Ref: Stage
Description: Experimental Restorer Play app in Lambda
@liesislukas
liesislukas / .eslintrc.js
Created September 3, 2021 06:06
Eslint rules to work next to prettier. I use prettier's default to format everything and eslint to highlight code issues.
module.exports = {
env: {
browser: true,
es6: true,
node: true,
commonjs: true,
},
extends: ["eslint:recommended", "plugin:react/recommended"],
globals: {
Atomics: "readonly",
@liesislukas
liesislukas / post_install_script.js
Created August 24, 2021 10:42
reactjs app webpack dev server file watch delay fix for react-scripts
/*
In package.json:
"postinstall": "node ./extras/post_install_script.js"
*/
const fs = require("fs");
const path = require("path");
const _filePath = path.join(__dirname, "../node_modules/react-scripts/config/webpackDevServer.config.js");
version: 0.2
env:
variables:
PORT: "2000"
REACT_APP_ENV: "production"
REACT_APP_TITLE: "My App"
REACT_APP_FAVICON: "favicon.ico"
REACT_APP_LOGO_TYPE: "vertical"
phases:
install:
@liesislukas
liesislukas / zoomAt.js
Created May 26, 2021 11:08
retejs zoom nodes with animation utility function
const min = (arr) => (arr.length === 0 ? 0 : Math.min(...arr));
const max = (arr) => (arr.length === 0 ? 0 : Math.max(...arr));
export function nodesBBox({editor, nodes}) {
const left = min(nodes.map((node) => node.position[0]));
const top = min(nodes.map((node) => node.position[1]));
const right = max(nodes.map((node) => node.position[0] + editor.view.nodes.get(node).el.clientWidth));
const bottom = max(nodes.map((node) => node.position[1] + editor.view.nodes.get(node).el.clientHeight));
return {
@liesislukas
liesislukas / helperGetId.js
Last active February 5, 2021 10:06
helperGetId
// sample usage:
// uuid npm v3.3.2
// any-base npm v1.1.0
// const ___getId = require('./getId');
// const branchId = `b-${(await ___getId({})).id}`;
const uuid = require('uuid');
const anyBase = require('any-base');
@liesislukas
liesislukas / countryUtilities.js
Created November 30, 2020 15:11
country and locale list country code to name, locale code to language
/* eslint-disable max-lines */
const isoCountries = {
'AF': 'Afghanistan',
'AX': 'Aland Islands',
'AL': 'Albania',
'DZ': 'Algeria',
'AS': 'American Samoa',
'AD': 'Andorra',
'AO': 'Angola',
'AI': 'Anguilla',