Skip to content

Instantly share code, notes, and snippets.

View devthejo's full-sized avatar

Jo devthejo

View GitHub Profile

Multiple repos -> mono repo with history from old repos

mkdir monorepo
cd monorepo
git init .

# fetch old repos
git remote add repo_1 XXX
git fetch repo_1
# /Users/xxx/Library/Application Support/k9s/hotkey.yml
hotKey:
# Hitting Shift-0 navigates to your CNPG clusters
shift-Q:
shortCut: Shift-Q
description: Viewing CNPG clusters
command: postgresql.cnpg.io/v1/clusters
@DanielPantle
DanielPantle / StrapiImage.tsx
Last active January 17, 2024 13:08
Next.js ImageLoader for Strapi
// custom Next.js component for displaying Strapi images with a custom loader
// NEXT_PUBLIC_BACKEND_URL_IMAGES needs to be set in the .env file, e.g.: NEXT_PUBLIC_BACKEND_URL_IMAGES=http://localhost:1337
// For placeholders to work, install strapi-plugin-placeholder
'use client';
import { default as NextImage, ImageLoader, ImageProps } from 'next/image';
import _strapiBreakpoints from '/src/data/preBuild/strapiBreakpoints.json';
export interface IStrapiImage {
@claysauruswrecks
claysauruswrecks / requirements.txt
Last active April 7, 2024 16:32
Example using LlamaHub loaders to index Github repos into LlamaIndex and query GPTSimpleVectorIndex with GPT-4
# main
llama-index
langchain
@belgattitude
belgattitude / ci-yarn-install.md
Last active May 1, 2024 09:31
Composite github action to improve CI time with yarn 3+ / node-modules linker.
@clqu
clqu / Modal.jsx
Created May 9, 2022 19:01
This is a modal component made with TailwindCSS and Next.js.
const { Fragment, useState, useEffect } = require("react");
const { Transition } = require("@headlessui/react");
module.exports = ({
title = "",
content = "",
buttons = [],
classes = "",
onDiscard = "",
onConfirm = "",
@sindresorhus
sindresorhus / esm-package.md
Last active May 6, 2024 13:26
Pure ESM package

Pure ESM package

The package that linked you here is now pure ESM. It cannot be require()'d from CommonJS.

This means you have the following choices:

  1. Use ESM yourself. (preferred)
    Use import foo from 'foo' instead of const foo = require('foo') to import the package. You also need to put "type": "module" in your package.json and more. Follow the below guide.
  2. If the package is used in an async context, you could use await import(…) from CommonJS instead of require(…).
  3. Stay on the existing version of the package until you can move to ESM.

Introduction to the Regular Expression Challenges

This is note of regular expression from freecodecamp

  • Regular expressions are special strings that represent a search pattern. Also known as "regex" or "regexp", they help programmers match, search, and replace text.
  • Regular expressions can appear cryptic because a few characters have special meaning.
  • The goal is to combine the symbols and text into a pattern that matches what you want, but only what you want.

Regular Expressions: Using the Test Method

  • JavaScript has multiple ways to use regexes. One way to test a regex is using the .test() method. The .test() method takes the regex, applies it to a string (which is placed inside the parentheses), and returns true or false if your pattern finds something or not.
@nickboldt
nickboldt / dockerContainerExtract.sh
Last active November 10, 2022 01:03
extract files from docker image to local dir
#!/bin/bash -e
usage ()
{
echo "Usage: $0 CONTAINER [--override-arch s390x] [--tar-flags tar-extraction-flags]"
echo "Usage: $0 quay.io/crw/operator-metadata:latest"
echo "Usage: $0 quay.io/crw/plugin-java8-openj9-rhel8:2.4 --override-arch s390x"
echo "Usage: $0 quay.io/crw/pluginregistry-rhel8:latest --tar-flags var/www/html/*/external_images.txt"
echo "Usage: $0 quay.io/crw/devfileregistry-rhel8:latest --tar-flags var/www/html/*/external_images.txt --override-arch ppc64le"
exit
@superseb
superseb / restore_rancher2_agents.md
Last active October 10, 2023 06:29
Restore Rancher 2 cluster/node agents on clusters

Restore Rancher 2 cluster/node agents on clusters

This is an unsupported scenario, see rancher/rancher#14731 when there is an official solution.

When cattle-cluster-agent and/or cattle-node-agent are accidentally deleted, or when server-url/cacerts are changed.

Generate definitions

  • Generate API token in the UI (user -> API & Keys) and save the Bearer token
  • Find the clusterid in the Rancher UI (format is c-xxxxx), its in the address bar when the cluster is selected