Skip to content

Instantly share code, notes, and snippets.

View 0-vortex's full-sized avatar
:shipit:
looking out for #0

TED Vortex (Teodor-Eugen Duțulescu) 0-vortex

:shipit:
looking out for #0
View GitHub Profile
@0-vortex
0-vortex / useStorage.tsx
Created February 27, 2024 07:12 — forked from JohnBra/useStorage.tsx
Typed React useStorage hook for chrome extensions
import { Dispatch, SetStateAction, useState, useEffect, useCallback, useRef } from 'react';
export type StorageArea = 'sync' | 'local';
// custom hook to set chrome local/sync storage
// should also set a listener on this specific key
type SetValue<T> = Dispatch<SetStateAction<T>>;
/**
@0-vortex
0-vortex / llama2-mac-gpu.sh
Created July 21, 2023 19:40 — forked from adrienbrault/llama2-mac-gpu.sh
Run Llama-2-13B-chat locally on your M1/M2 Mac with GPU inference. Uses 10GB RAM
# Clone llama.cpp
git clone https://github.com/ggerganov/llama.cpp.git
cd llama.cpp
# Build it
LLAMA_METAL=1 make
# Download model
export MODEL=llama-2-13b-chat.ggmlv3.q4_0.bin
wget "https://huggingface.co/TheBloke/Llama-2-13B-chat-GGML/resolve/main/${MODEL}"
# Source: https://gist.github.com/vfarcic/78c1d2a87baf31512b87a2254194b11c
###############################################################
# How To Create A Complete Internal Developer Platform (IDP)? #
# https://youtu.be/Rg98GoEHBd4 #
###############################################################
# Additional Info:
# - DevOps MUST Build Internal Developer Platform (IDP): https://youtu.be/j5i00z3QXyU
# - How To Create A "Proper" CLI With Shell And Charm Gum: https://youtu.be/U8zCHA-9VLA
@0-vortex
0-vortex / postgres-cheatsheet.md
Created May 7, 2023 01:59 — forked from Kartones/postgres-cheatsheet.md
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)
@0-vortex
0-vortex / esm-package.md
Created April 2, 2023 14:01 — forked from sindresorhus/esm-package.md
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.
@0-vortex
0-vortex / api-filter-query.ts
Created August 7, 2022 00:48 — forked from MarZab/api-filter-query.ts
NestJS Filters with Swagger deepObject (example: `?filters[name]=thing1&filters[description]=thing2`)
import { applyDecorators } from '@nestjs/common';
import { ApiExtraModels, ApiQuery, getSchemaPath } from '@nestjs/swagger';
/**
* Combines Swagger Decorators to create a description for `filters[name]=something`
* - has support for swagger
* - automatic transformation with nestjs
*/
// eslint-disable-next-line @typescript-eslint/ban-types,@typescript-eslint/explicit-module-boundary-types
export function ApiFilterQuery(fieldName: string, filterDto: Function) {
@0-vortex
0-vortex / keybase.md
Created July 14, 2019 01:20 — forked from webframp/keybase.md
Signing git commits on github using keybase.io gpg key

Probably one of the easiest things you'll ever do with gpg

Install Keybase: https://keybase.io/download and Ensure the keybase cli is in your PATH

First get the public key

keybase pgp export | gpg --import

Next get the private key