Skip to content

Instantly share code, notes, and snippets.

View adamwdennis's full-sized avatar
🤖
Learn, learn, learn

Adam Dennis adamwdennis

🤖
Learn, learn, learn
View GitHub Profile
@adamwdennis
adamwdennis / local-llama3-macos.txt
Created April 23, 2024 12:37
Running Llama3 locally...
# Make sure you have the following installed:
# 1. homebrew for MacOS
# 2. docker desktop for MacOS
# Run the following commands, in order:
brew install ollama;
ollama serve &;
ollama pull llama3;
docker run -d -p 3000:8080 --add-host=host.docker.internal:host-gateway -v open-webui:/app/backend/data --name open-webui --restart always ghcr.io/open-webui/open-webui:main
@adamwdennis
adamwdennis / update-objects.tsx
Last active May 18, 2022 12:24
Comparing two objects for additions, deletions, and updates.
const existingFields = [
{
id: "1",
name: "",
value: "6.2%",
related_id: "1",
},
{
id: "3",
name: "",
@mattpetters
mattpetters / ConnectionType.ts
Last active December 5, 2022 07:28
TypeORM + TypeScript + Dataloader + Relay Spec (connections, pagination)
import { Connection, Edge } from 'graphql-relay'
import { ClassType, Field, ObjectType } from 'type-graphql'
import { PageInfo } from '../PageInfo'
export function ConnectionType<V>(EdgeType: ClassType<V>) {
// `isAbstract` decorator option is mandatory to prevent registering in schema
@ObjectType({ isAbstract: true, description: 'A connection to a list of items.'})
abstract class ConnectionClass implements Connection<V>{
// here we use the runtime argument
@tumainimosha
tumainimosha / page-info.ts
Last active August 29, 2023 11:02
NestJS Graphql Cursor Based pagination
import { ObjectType, Field } from "@nestjs/graphql";
@ObjectType()
export class PageInfo {
@Field({ nullable: true })
startCursor: string;
@Field({ nullable: true })
endCursor: string;
@jmagnuss
jmagnuss / ApolloIdempotent.ts
Created February 1, 2020 01:25
Empty plugin sample for Apollo Server
import {
ApolloServerPlugin,
GraphQLRequestContext,
GraphQLRequestListener,
GraphQLServiceContext,
GraphQLResponse,
} from 'apollo-server-plugin-base';
import {
ApolloError,
AuthenticationError,
@ygotthilf
ygotthilf / jwtRS256.sh
Last active April 30, 2024 18:17
How to generate JWT RS256 key
ssh-keygen -t rsa -b 4096 -m PEM -f jwtRS256.key
# Don't add passphrase
openssl rsa -in jwtRS256.key -pubout -outform PEM -out jwtRS256.key.pub
cat jwtRS256.key
cat jwtRS256.key.pub
@Kartones
Kartones / postgres-cheatsheet.md
Last active April 30, 2024 19:47
PostgreSQL command line cheatsheet

PSQL

Magic words:

psql -U postgres

Some interesting flags (to see all, use -h or --help depending on your psql version):

  • -E: will describe the underlaying queries of the \ commands (cool for learning!)
  • -l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)