Skip to content

Instantly share code, notes, and snippets.

View cem2ran's full-sized avatar
⚛️
~ The only constant is change ~

Cem Turan cem2ran

⚛️
~ The only constant is change ~
View GitHub Profile
@tsensei
tsensei / semantic-chunker.ts
Created April 5, 2024 14:33
This TypeScript snippet processes a large corpus of text to output semantic chunks by tokenizing into sentences, combining them for context, generating sentence embeddings with OpenAI's service, calculating cosine similarities to identify semantic shifts, and finally grouping sentences into semantically cohesive chunks based on these shifts.
import "dotenv/config";
import { OpenAIEmbeddings } from "@langchain/openai";
import { TextLoader } from "langchain/document_loaders/fs/text";
import natural from "natural";
import * as math from "mathjs";
import { quantile } from "d3-array";
interface SentenceObject {
sentence: string;
index: number;
@yoavg
yoavg / GM-level-chess-without-search.md
Last active June 16, 2024 02:43
Grand-master Level Chess without Search

Grand-master Level Chess without Search: Modeling Choices and their Implications

Yoav Golderg, February 2024.


Researchers at Google DeepMind released a paper about a learned systems that is able to play blitz-chess at a grandmaster level, without using search. This is interesting and imagination-capturing, because up to now computer-chess systems that play at this level, either based on machine-learning or not, did use a search component.[^1]

Indeed, my first reaction when reading the paper was to tweet wow, crazy and interesting. I still find it crazy and interesting, but upon a closer read, it may not be as crazy and as interesting as I initially thought. Many reactions on twitter, reddit, etc, were super-impressed, going into implications about projected learning abilities of AI systems, the ability of neural networks to learn semantics from observations, etc, which are really over-the-top. The paper does not claim any of them, but they are still perceiv

@virattt
virattt / rag-reranking-gpt.ipynb
Last active May 14, 2024 09:22
rag-reranking-gpt.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
from diffusers import DiffusionPipeline, StableDiffusionXLImg2ImgPipeline
import torch
model = "stabilityai/stable-diffusion-xl-base-1.0"
pipe = DiffusionPipeline.from_pretrained(
model,
torch_dtype=torch.float16,
)
pipe.to("cuda")
pipe.load_lora_weights("model/", weight_name="pytorch_lora_weights.safetensors")
@postmalloc
postmalloc / hn_sidebar.js
Last active August 30, 2023 08:10
Hacker News comments sidebar bookmarklet
// A handy bookmarklet to display comments from the top-rated Hacker News thread related to the current page
// Written with the help of GPT-4
javascript:(function() {
const createCommentElement = (comment, depth) => {
const commentWrapper = document.createElement('div');
commentWrapper.style.paddingLeft = (depth * 20) + 'px';
commentWrapper.style.marginBottom = '10px';
commentWrapper.style.marginLeft = '10px';
commentWrapper.style.color = '#333';
@johnzweng
johnzweng / New signs of satoshi.md
Last active July 20, 2024 06:19
Some technical facts around the story about the message allegedly signed by Hal Finney about Paul Le Roux being Satoshi.

New signs of Satoshi?

A few days ago, another sensationalist news story emerged, promising new clues regarding the true identity of Satoshi Nakamoto: Allegedly, an old message signed by Hal Finney had surfaced (published by Martin Shkreli in this blog post), suggesting that Paul Le Roux was the person behind the synonym of Satoshi Nakamoto.

I briefly highlight the facts surrounding this story:

The signed message:

Right away, yes indeed, a valid signed message has surfaced:

@dienhoa
dienhoa / SSD.ipynb
Created August 21, 2022 08:27
SSD Implementation using fastai
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@souporserious
souporserious / createComponent.tsx
Last active April 10, 2021 22:30
createComponent API exploration for JSXUI
import { createComponent, Stack, Text, Theme, Events } from '@jsxui/react'
export type ButtonProps = {
title: string
background: Theme.Color
color: Theme.Color
stroke: {
align: 'inside' | 'outside'
size: number
color: Theme.Color
@Alia5
Alia5 / cheatsheet.ts
Last active May 17, 2023 08:46
Advanced Typescript Cheatsheet
export type Await<T> = T extends PromiseLike<infer U> ? Await<U> : T;
export type IsPromise<T> = PromiseLike<infer U> ? true : false;
export type Length<T> = T extends { length: infer L } ? L : never;
export type KeysOfType<O, T> = {
[K in keyof O]: O[K] extends T ? K : never;
}[keyof O];
// ConvertLiterals would convert literal types like `1337` to their base type like `number` if set to true