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
#!/usr/bin/env sh | |
# script flags | |
VERBOSE=true | |
# default inputs | |
DEFAULT_TEXT="The quick brown fox jumps over the lazy dog. Yes, the quick brown fox." | |
DEFAULT_COUNT=10 | |
# check if input is redirected |
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
// u128 seem like the right type for debiting and crediting atoms of gold | |
// u256 should be enough account for all the gold atoms in the universe | |
// micrograms of gold seem like a good unit for small transactions | |
fn gold_atoms_in_microgram(quantity: f64) -> u128 { | |
const AVOGADROS_NUMBER: f64 = 6.02214076e23; // atoms | |
const ATOMIC_WEIGHT_OF_GOLD: u128 = 196_966_570; // microgram/mol | |
(quantity * AVOGADROS_NUMBER) as u128 / ATOMIC_WEIGHT_OF_GOLD | |
} |
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
use std::fmt; | |
#[derive(Debug, Copy, Clone)] | |
#[allow(dead_code)] | |
enum Sex { | |
Male, | |
Female, | |
} | |
impl Sex { |
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
extern crate sdl2; | |
use sdl2::{ | |
audio::{ AudioCallback, AudioSpecDesired, }, | |
event::Event, | |
pixels::Color, | |
}; | |
use std::{ time::{ Duration, Instant, }, }; | |
#[derive(Copy, Clone)] |
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
extern crate sdl2; | |
use sdl2::audio::{ AudioCallback, AudioSpecDesired, }; | |
#[derive(Copy, Clone)] | |
enum Note { | |
A = 0, | |
ASharp = 1, | |
B = 2, | |
C = 3, |
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::{ vec, vec::Vec, }; | |
use core::convert::TryInto; | |
use libc::{ c_int, printf, }; | |
struct Room { | |
x: 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
#![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] |
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
// 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
#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"); | |
} |
NewerOlder