This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Html | |
quote(do: markup do: text("hi")) |> Code.eval_quoted | |
markup do: text("hi") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Reference: | |
# http://webstaff.itn.liu.se/~stegu/simplexnoise/simplexnoise.pdf | |
# Classic Perlin noise in 3D, for comparison | |
defmodule ClassicNoise do | |
@grad3 { | |
{1, 1, 0}, {-1, 1, 0}, {1, -1, 0}, {-1, -1, 0}, | |
{1, 0, 1}, {-1, 0, 1}, {1, 0, -1}, {-1, 0, -1}, | |
{0, 1, 1}, {0, -1, 1}, {0, 1, -1}, {0, -1, -1} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Reference: | |
# http://webstaff.itn.liu.se/~stegu/simplexnoise/simplexnoise.pdf | |
# Simplex noise in 2D, 3D and 4D | |
defmodule SimplexNoise do | |
@grad3 { | |
{1, 1, 0}, {-1, 1, 0}, {1, -1, 0}, {-1, -1, 0}, | |
{1, 0, 1}, {-1, 0, 1}, {1, 0, -1}, {-1, 0, -1}, | |
{0, 1, 1}, {0, -1, 1}, {0, 1, -1}, {0, -1, -1} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# A speed-improved simplex noise algorithm for 2D, 3D and 4D | |
# translated from Java into Elixir. | |
# | |
# Based on example code by Stefan Gustavson ([email protected]). | |
# Optimisations by Peter Eastman ([email protected]). | |
# Better rank ordering method for 4D by Stefan Gustavson in 2012. | |
# Translated into Elixir by Brendan Sechter ([email protected]). | |
# | |
# The Java version could be speeded up even further, but it's useful | |
# as it is. Assessment of Java optimazations for the Elixir version |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Reference: | |
# http://www.csee.umbc.edu/~olano/s2002c36/ch02.pdf | |
# https://www.google.com/patents/US6867776 | |
# A complete implementation of a function returning a value that | |
# conforms to the new method is given below. | |
# Translated from Java class definition to Elixir module. | |
defmodule SimplexNoiseReference do | |
use Bitwise |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# PostgreSQL `mix ecto.create` equivalent | |
psql -c "CREATE USER ${DB_USER} WITH PASSWORD '${DB_PASSWORD}';" | |
createdb "${DB_NAME}" | |
psql -c "GRANT ALL PRIVILEGES ON DATABASE ${DB_NAME} to ${DB_USER};" | |
# PostgreSQL `mix ecto.drop` equivalent | |
dropdb "${DB_NAME}" | |
dropuser "${DB_USER}" | |
# PostgresSQL interactive terminal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdbool.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
void usage(const char *pProgramName) { | |
printf("Usage: %s x y z ...\n", pProgramName); | |
printf("Example: %s 818 -3 566 5 12 100 12 25\n", pProgramName); | |
printf(" This program will sort numbers in ascending order.\n"); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ChatGPT Prompt | |
// Please write a Rust function to generate rooms in a Rogue style dungeon. | |
// Thoughts: | |
// As far as basic structure goes, this works. It needs a lot of work to be useful. | |
use rand::Rng; | |
struct Dungeon { | |
width: usize, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(map | |
(lambda (image) | |
(gimp-image-undo-group-start image) | |
(define fullpath (car (gimp-image-get-filename image))) | |
(define filename (car (reverse (strbreakup fullpath "/")))) | |
(define path (car (strbreakup fullpath filename))) | |
(define basefilename (car (strbreakup filename "."))) | |
(define xcfpath (string-append path basefilename ".xcf")) | |
(define linepath (string-append path "bw_" basefilename ".png")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#![no_std] | |
extern crate alloc; | |
extern crate libc; | |
use alloc::{ boxed::Box, ffi::CString, string::{ String, ToString, } }; | |
use hashbrown::HashMap; | |
use libc::{ c_char, c_void, printf, }; | |
#[no_mangle] |
OlderNewer