import jwt from "jsonwebtoken"; // Use um bundler para incluir dependΓͺncias externas, se necessΓ‘rio.
addEventListener("fetch", (event) => {
event.respondWith(handleRequest(event.request));
});
async function handleRequest(request) {
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mkdir -p ~/.config/husky && echo 'export NVM_DIR="$HOME/.nvm" | |
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm' > ~/.config/husky/init.sh |
Just replace PATH_TO_YOUR_MODELS with the absolute (or relative) path to your ollama models directory (usually /usr/share/ollama/.ollama/models/)
sudo find PATH_TO_YOUR_MODELS -type f -exec chown ollama:ollama {} \;
sudo find PATH_TO_YOUR_MODELS -type d -exec chown ollama:ollama {} \;
sudo find PATH_TO_YOUR_MODELS -type f -exec chmod 644 {} \;
sudo find PATH_TO_YOUR_MODELS -type d -exec chmod 755 {} \;
PS: kudos for Jeron_Baffom
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
find . -type d -name ".git" -exec sh -c 'repo_dir=$(dirname "{}"); echo "Processando repositΓ³rio: $repo_dir"; cd "$repo_dir" && [ -d .git ] && git diff -p -R --no-ext-diff --no-color --diff-filter=M | grep -E "^(diff|(old|new) mode)" --color=never | git apply' \; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
######### | |
##### THIS SCRIPT CAN FUCK YOUR COMPUTER, use it on your own responsibility | |
######### | |
# User directory path | |
read -p "Enter the username or press Enter to use the current user ($(logname)): " input_user | |
USER_HOME="/home/${input_user:-$(logname)}" | |
# Function to apply permissions |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bruno in next-mf-host-with-mandatory-libs/apps/remote on ξ main [!?] took 8.3s | |
β npm run dev | |
> @demo/[email protected] dev | |
> next dev -p 3011 | |
npm ERR! code ENOWORKSPACES | |
npm ERR! This command does not support workspaces. | |
npm ERR! A complete log of this run can be found in: /home/bruno/.npm/_logs/2023-11-24T19_33_46_944Z-debug-0.log |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// remote | |
// uses xlib@10 as a singleton | |
import { generate } from 'xlib'; // hey, I'm a singleton and I will have only one global instance in memory =] | |
// the federated component | |
export default function GenerateSomethingButton() { | |
const content = generate(); | |
return <h1>{content}</h1>; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const path = require('path'); | |
/** | |
* @type {import('webpack').Configuration & { devServer?: import('webpack-dev-server').Configuration }}} | |
*/ | |
module.exports = { | |
entry: './src/index.js', | |
output: { | |
filename: 'main.js', | |
path: path.resolve(__dirname, 'dist'), |
This example shows abstracts the way Apollo Client creates its Context components to avoid context duplication, you can see the Apollo original code here
The main idea is to give you the ability to share a React Context between packages and applications, like Microfrontends with Module Federation.
// global-context.ts
import * as React from "react";
export function getGlobalContext<P = {}>(
Remote that shares the components defines a Sentry.hub instance defining some tags that will be used by the host during the dispatch of the logs to Sentry server
import * as Sentry from "@sentry/browser";
const hub = new Sentry.Hub();
hub.configureScope((scope) => {
scope.setTag("Host", "shop");
scope.setTag("Team", "shop-team");
NewerOlder