Skip to content

Instantly share code, notes, and snippets.

@rauchg
rauchg / p.sh
Last active May 18, 2024 13:05
Perplexity CLI in pure shell
#!/usr/bin/env bash
function p() {
jq -n \
--arg content "$*" \
'{
"model": "pplx-7b-online",
"messages": [
{
"role": "system",
"content": "Be precise and concise."
@kamilogorek
kamilogorek / _screenshot.md
Last active May 27, 2024 12:50
Clutter-free VS Code Setup
image
@imkarimkarim
imkarimkarim / setNewVersion.js
Last active December 30, 2023 23:26
version setter script
// nodejs script that adds a new version to the project. (git(local, and remote), package.json and a commit message)
// example: node setNewVersion.js 0.0.1
const fs = require('fs');
const path = require('path');
const { exec } = require('child_process');
let v = process.argv[2];
if (v.charAt(0) === 'v') {
v = v.substring(1);
@hayden-donnelly
hayden-donnelly / make_crop_labels.py
Last active January 27, 2024 04:29
Script to make square crop labels for images.
# Example usage:
# python make_crop_labels.py --input_path data/images --output_path --data/cropped_images --csv_path data/crops.csv
# Controls:
# scroll to change crop size, mouse to aim the crop, left click to crop image and move to next, x to skip to the next image.
# The script is pretty messy since I quickly hacked it together with little regard for quality, but it works.
import pygame
import argparse
@mitchellh
mitchellh / merge_vs_rebase_vs_squash.md
Last active July 4, 2024 13:50
Merge vs. Rebase vs. Squash

I get asked pretty regularly what my opinion is on merge commits vs rebasing vs squashing. I've typed up this response so many times that I've decided to just put it in a gist so I can reference it whenever it comes up again.

I use merge, squash, rebase all situationally. I believe they all have their merits but their usage depends on the context. I think anyone who says any particular strategy is the right answer 100% of the time is wrong, but I think there is considerable acceptable leeway in when you use each. What follows is my personal and professional opinion:

@hayden-donnelly
hayden-donnelly / data_filter.py
Last active December 10, 2023 10:41
Script to filter images from input directory to output directory
# Run with: python data_filter.py --input_path <input path> --output_path <output path>
# Controls: z to copy image into output directory, x to skip to next image.
import pygame
import argparse
import shutil
import os
import argparse
def load_image(path):
@levelsio
levelsio / gist:5bc87fd1b1ffbf4a705047bebd9b4790
Last active July 9, 2024 10:41
Secret of Monkey Island: Amsterdam (by @levelsio) or how to create your own ChatGPT image+text-based adventure game
# 2023-11-27 MIT LICENSE
Here's the open source version of my ChatGPT game MonkeyIslandAmsterdam.com.
It's an unofficial image+text-based adventure game edition of Monkey Island in Amsterdam, my home town.
Please use it however you want. It'd be nice to see more ChatGPT-based games appear from this. If you get inspired by it, please link back to my X https://x.com/levelsio or this Gist so more people can do the same!
Send me your ChatGPT text adventure game on X, I'd love to try it!
@kconner
kconner / macOS Internals.md
Last active July 7, 2024 19:42
macOS Internals

macOS Internals

Understand your Mac and iPhone more deeply by tracing the evolution of Mac OS X from prelease to Swift. John Siracusa delivers the details.

Starting Points

How to use this gist

You've got two main options:

@jimsrc
jimsrc / gpt4_text_compression.md
Last active June 18, 2024 15:03
Minimizing the number of tokens usage to interact with GPT-4.

Overview

I just read this trick for text compression, in order to save tokens in subbsequent interactions during a long conversation, or in a subsequent long text to summarize.

SHORT VERSION:

It's useful to give a mapping between common words (or phrases) in a given long text that one intends to pass later. Then pass that long text to gpt-4 but encoded with such mapping. The idea is that the encoded version contains less tokens than the original text. There are several algorithms to identify frequent words or phrases inside a given text, such as NER, TF-IDF, part-of-speech (POS) tagging, etc.

@cassidoo
cassidoo / mergerefs.jsx
Created January 10, 2023 22:57
Merge refs in React so a component can have more than one ref
export function mergeRefs(refs) {
return (value) => {
refs.forEach((ref) => {
if (typeof ref === "function") {
ref(value);
} else if (ref != null) {
ref.current = value;
}
});
};