Skip to content

Instantly share code, notes, and snippets.

View alexjgriffith's full-sized avatar

AlexJGriffith alexjgriffith

View GitHub Profile
;; https://gamedev.stackexchange.com/questions/23625/how-do-you-generate-tileable-perlin-noise
(fn make-simplex-noise [radius? harmonics? width? height?]
"Generate 2d tiling simplex noise tile.
The generated tile will be saved in the user save directory.
radius? The radius of the x and y orthogonal circles in 4 d space. Larger radius ~= higher frequency
harmonics? How many harmonics do you want to include? Default 3
width? The width of the tile generated
height? The height the tile generated
example: (make-simplex-noise 10)"
(let [r (or radius? 10)
@alexjgriffith
alexjgriffith / install-zig.sh
Created September 15, 2022 05:46
Building Zig using Cmake on Ubuntu 20.04
# The following is for ziglang commit 86dc982e74dd17633d2bdc0f5ba8e36c55f78053
# This commit required llvm15, check the cmake errors to see which
# version of llvm you need.
# I assume you've already installed cmake git etc
# Check https://apt.llvm.org/ to see alternatives to this garbage
bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)"
# Install the dependencies not found on path
@alexjgriffith
alexjgriffith / eshell-prompt-git-status.el
Last active March 9, 2018 19:30
View the current git branch in your elsip prompt.
(defun git-changes-p ()
"Check if there are any changes to the git repo."
(with-temp-buffer
(process-file-shell-command "git status --porcelain" nil (current-buffer) nil)
(not(string= "" (buffer-string)))))
(defun git-branch ()
"Return the current branch of the git repo."
(interactive)
(or (ignore-errors (magit-get-current-branch))
@alexjgriffith
alexjgriffith / finding-gargron.el
Last active March 6, 2018 04:25
Hacking together bits of mastodon.el to load @Gargron's toots with media
(defun lookup-user (user)
(let* ((json (mastodon-http--get-json
(mastodon-http--api (concat "search?q="
user))))
(accounts (cdr(assoc 'accounts json)))
(acct (mapcar (lambda(account) (cdr (assoc 'acct account)))
accounts))
(ids (mapcar (lambda(account) (cdr (assoc 'id account)))
accounts)))
(cl-mapcar (lambda(a b) (list a b)) acct ids)))