Skip to content

Instantly share code, notes, and snippets.

View fogleman's full-sized avatar

Michael Fogleman fogleman

View GitHub Profile
@fogleman
fogleman / words.md
Last active April 14, 2024 08:42
Mnemonic Encoding Word List

Mnemonic Encoding Word List

http://web.archive.org/web/20090918202746/http://tothink.com/mnemonic/wordlist.html

  • The wordlist contains 1626 words.
  • All words are between 4 and 7 letters long.
  • No word in the list is a prefix of another word (e.g. visit, visitor).
  • Five letter prefixes of words are sufficient to be unique.
  • The words should be usable by people all over the world. The list is far from perfect in that respect. It is heavily biased towards western culture and English in particular. The international vocabulary is simply not big enough. One can argue that even words like "hotel" or "radio" are not truly international. You will find many English words in the list but I have tried to limit them to words that are part of a beginner's vocabulary or words that have close relatives in other european languages. In some cases a word has a different meaning in another language or is pronounced very differently but for the purpose of the encoding it is still ok - I assume that when the encoding is
@fogleman
fogleman / README.md
Created March 15, 2024 00:43
ChatGPT-generated README for `hmm` based only on its .cpp files

This C++ application is designed to generate 3D models from heightmap images through triangulation, optionally adding solid bases and applying various modifications to the heightmap before processing. It also supports generating normal and hillshade maps based on the input heightmap. Below is a detailed usage guide, including implementation and algorithm details.

Usage

To use this application, you need to compile the provided source files (base.cpp, blur.cpp, heightmap.cpp, main.cpp, stl.cpp, triangulator.cpp, along with their headers) into an executable. The program requires specifying an input heightmap file and various optional parameters to control the output model's characteristics.

./heightmap_to_stl [options] infile [outfile.stl]
@fogleman
fogleman / main.py
Last active January 2, 2024 10:41
Collision Avoidance
from collections import deque
from math import sin, cos, pi, atan2, hypot
import random
import time
import wx
SIZE = 600
COUNT = 64
SPEED = 100
FOLLOWERS = 4
@fogleman
fogleman / dragon.py
Created December 30, 2015 16:36
Dragon Curve with Turtle Graphics (Python)
import turtle
def turn(i):
left = (((i & -i) << 1) & i) != 0
return 'L' if left else 'R'
def curve(iteration):
return ''.join([turn(i + 1) for i in range(2 ** iteration - 1)])
if __name__ == '__main__':
@fogleman
fogleman / snowflake.py
Last active December 28, 2021 00:21
Snowflake Generator
import random
import time
# inspiration: https://mathematica.stackexchange.com/questions/39361/how-to-generate-a-random-snowflake
# see https://www.redblobgames.com/grids/hexagons/ for information
# about hexagon grids and coordinate systems
# neighbors in axial coordinates
DIRS = [(1, 0), (1, -1), (0, -1), (-1, 0), (-1, 1), (0, 1)]
@fogleman
fogleman / rubix.py
Created August 14, 2021 18:57
Simple 2x2x2 Rubik's Cube Solver in Python
import sys
# -------
# | 16 17 |
# | Y |
# | 18 19 |
# ------- ------- ------- -------
# | 12 13 | 00 01 | 04 05 | 08 09 |
# | X | Z | X | Z |
# | 14 15 | 02 03 | 06 07 | 10 11 |
@fogleman
fogleman / osm.py
Created November 28, 2017 21:51
AxiDraw + OpenStreetMap
from imposm.parser import OSMParser
from shapely import geometry, ops
import axi
import math
import sys
# put your lat/lng here
LAT, LNG = 0, 0
@fogleman
fogleman / git_cheat_sheet.md
Created November 28, 2012 21:36 — forked from ryansturmer/git_cheat_sheet.md
Git Cheat Sheet

Git Cheat Sheet

This attempts to be a useful "cheat sheet" for git. I'm just writing git recipes down here as I find and use them.

Getting Code

Clone a repository (GitHub)

git clone git@github.com:username/repository.git
@fogleman
fogleman / dyson_spheres.ipynb
Created October 7, 2016 20:13
Dyson Spheres and Alien Megastructures
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@fogleman
fogleman / main.cpp
Last active March 8, 2021 22:31
Gray-Scott Reaction-Diffusion with OpenCL
#define CL_SILENCE_DEPRECATION
// #if defined(__APPLE__) || defined(__MACOSX)
// #include <OpenCL/cl.hpp>
// #else
// #include <CL/cl.hpp>
// #endif
#include "cl.hpp"