Skip to content

Instantly share code, notes, and snippets.

View zxkxyz's full-sized avatar
👖
listening to njz

zak zxkxyz

👖
listening to njz
View GitHub Profile
@zxkxyz
zxkxyz / add_to_zshrc.sh
Last active May 26, 2025 05:16 — forked from karpathy/add_to_zshrc.sh
Git Commit Message AI
# -----------------------------------------------------------------------------
# AI-powered Git Commit Function
# Copy paste this gist into your ~/.bashrc or ~/.zshrc to gain the `gcm` command. It:
# 1) gets the current staged changed diff
# 2) sends them to an LLM to write the git commit message
# 3) allows you to easily accept, edit, regenerate, cancel
# But - just read and edit the code however you like
# the `llm` CLI util is awesome, can get it here: https://llm.datasette.io/en/stable/
# ====== zxkxyz ======
@zxkxyz
zxkxyz / productofthree.js
Created January 22, 2016 02:20
productofthree
// It'll straight up compute permutations. Very inefficient time complexity wise.
// Something like O(n^3)? Might be wrong on that, I just know it's inefficient haha!
// This is one of the slowest ways to solve the problem because it has to computer
// a possible solution for every single permutation. It's nested for loops so we
// know it ought to be pretty slow.
function largestProductOfThree (array) {
var out;
var permutation = function(arr) {
var temp = 0; var first = true;