fossil – Hackaday https://hackaday.com Fresh hacks every day Tue, 29 Oct 2024 06:17:12 +0000 en-US hourly 1 https://wordpress.org/?v=6.6.2 156670177 Boss Byproducts: Fulgurites Are Fossilized Lightning https://hackaday.com/2024/10/29/boss-byproducts-fulgurites-are-fossilized-lightning/ https://hackaday.com/2024/10/29/boss-byproducts-fulgurites-are-fossilized-lightning/#comments Tue, 29 Oct 2024 17:00:19 +0000 https://hackaday.com/?p=707737&preview=true&preview_id=707737 So far in this series, we’ve talked about man-made byproducts — Fordite, which is built-up layers of cured car enamel, and Trinitite, which was created during the first nuclear bomb …read more]]>

So far in this series, we’ve talked about man-made byproducts — Fordite, which is built-up layers of cured car enamel, and Trinitite, which was created during the first nuclear bomb test.

A fulgurite pendant.
A lovely fulgurite pendant. Image via Etsy

But not all byproducts are man-made, and not all of them are basically untouchable. Some are created by Mother Nature, but are nonetheless dangerous. I’m talking about fulgurites, which can form whenever lightning discharges into the Earth.

It’s likely that even if you’ve seen a fulgurite, you likely had no idea what it was. So what are they, exactly? Basically, they are natural tubes of glass that are formed by a fusion of silica sand or rock during a lightning strike.

Much like Lichtenberg figures appear across wood, the resulting shape mimics the path of the lightning bolt as it discharged into the ground. And yes, people make jewelry out of fulgurites.

Lightning Striking Again

Lightning striking a tree. Poor tree.
Image via NOAA’s National Severe Storms Laboratory

Lightning is among the oldest observed phenomena on Earth. You probably know that lightning is just a giant spark of electricity in the atmosphere. It can occur between clouds, the air, or the ground and often hits tall things like skyscrapers and mountaintops.

Lightning is often visible during volcanic eruptions, intense forest fires, heavy snowstorms, surface nuclear detonations, and of course, thunderstorms.

In lightning’s infancy, air acts as an insulator between charges — the positive and negative charges between the cloud and the ground. Once the charges have sufficiently built up, the air’s insulating qualities break down and the electricity is rapidly discharged in the form of lightning.

When lightning strikes, the energy in the channel briefly heats up the air to about 50,000 °F, which is several times the surface of the Sun. This makes the air explode outward. As the shock wave’s pressure decreases, we hear thunder.

Of Sand and Rock and Other Stuff

Fulgurites, also known as fossilized lightning, don’t have a fixed composition: they are composed of whatever they’re composed of at the time of the lightning strike. Four main types of fulgurites are officially recognized: sand, soil, caliche (calcium-rich), and  rock fulgurites. Sand fulgurites can usually be found on beaches or in deserts where clean sand devoid of silt and clay dominates. And like those Lichtenberg figures, sand fulgurites tend to look like branches of tubes. They have rough surfaces comprised of partially-melted grains of sand.

An assortment of sand fulgurites.
Sand fulgurites, aka forbidden churros. Image via Wikimedia Commons

When sand fulgurites are formed, the sand rapidly cools and solidifies. Because of this, they tend to take on a glassy interior. As you might imagine, the size and shape of a fulgurite depends on several factors, including the strength of the strike and the depth of the sand being struck. On average, they are 2.5 to 5 cm in diameter, but have been found to exceed 20 cm.

Soil fulgurites can form in a wide variety of sediment compositions including clay-, silt-, and gravel-rich soils as well as leosses, which are wind-blown formations of accumulated dust. These also appear as tubaceous or branching formations, vesicular, irregular, or a combination thereof.

Calcium-rich sediment fulgurites have thick walls and variable shapes, although it’s common for multiple narrow channels to appear. These can run the gamut of morphological and structural variation for objects that can be classified as fulgurites.

Rock fulgurites are typically found on mountain peaks, which act as natural lightning rods. They appear as coatings or crusts of glass formed on rocks, either found as branching channels on the surface, or as lining in pre-existing fractures in the rock. They are most often found at the summit or within several feet of it.

Fact-Finding Fulgurites

Aside from jewelry and such, fulgurites’ appeal comes in wherever they’re found, as their presence can be used to estimate the number of lightning strikes in an area over time.

Then again there’s some stuff you may not necessarily want to use in jewelry making. Stuff that can be found in the dark, dank corners of the Earth. Stay tuned!

]]>
https://hackaday.com/2024/10/29/boss-byproducts-fulgurites-are-fossilized-lightning/feed/ 15 707737 FossilizedLightning A fulgurite pendant. Lightning striking a tree. Poor tree. An assortment of sand fulgurites.
Linux Fu: Automatic Header File Generation https://hackaday.com/2021/11/08/linux-fu-automatic-header-file-generation/ https://hackaday.com/2021/11/08/linux-fu-automatic-header-file-generation/#comments Mon, 08 Nov 2021 18:01:20 +0000 https://hackaday.com/?p=503297 I’ve tried a lot of the “newer” languages and, somehow, I’m always happiest when I go back to C++ or even C. However, there is one thing that gets a …read more]]>

I’ve tried a lot of the “newer” languages and, somehow, I’m always happiest when I go back to C++ or even C. However, there is one thing that gets a little on my nerves when I go back: the need to have header files with a declaration and then a separate file with almost the same information duplicated. I constantly make a change and forget to update the header, and many other languages take care of that for you. So I went looking for a way to automate things. Sure, some IDEs will automatically insert declarations but I’ve never been very happy with those for a variety of reasons. I wanted something lightweight that I could use in lots of different toolsets.

I found an older tool, however, that does a pretty good job, although there are a few limitations. The tool seems to be a little obscure, so I thought I’d show you what makeheaders — part of the Fossil software configuration management system. The program dates back to 1993 when [Dwayne Richard Hipp] — the same guy that wrote SQLite — created it for his own use. It isn’t very complex — the whole thing lives in one fairly large C source file but it can scan a directory and create header files for everything. In some cases, you won’t need to make big changes to your source code, but if you are willing, there are several things you can do.

The Problem

Suppose you have two C files that cooperate. Let’s say you have A.c and B.c. Inside the A file, you have a simple function:


double ctof(double c)
{
  return (9.0*c)/5+32.0;
}

If you expect to use this inside file B, there needs to be a declaration so that when you compile B, the compiler can know that the function takes a single double argument and returns a double. With ANSI C (and C++) you need something like:

double ctof(double c);

There’s no actual programming, just a note to the compiler about what the function looks like. This is what you call a prototype. Normally, you’ll create a header file with the prototype. You can include that header in both A.c and B.c.

The problem is when you change the function in A.c:

double ctof(double c1, int double c2)
{
  return (9.0*(c1+c2))/5+32.0;
}

If you don’t change the header to match, you’ll have problems. Not only that, but you need to make the same change. If you make a mistake and mark the arguments as floats in the header, that won’t work either.

The Program

Assuming you’ve installed the software, you can simply run it passing all the C and H files you want it to scan. Usually, the glob *.[ch] will do the trick. You can also use it with .cpp files and even a mix. By default, this will pull all the global variable declarations and global functions you define into a series of header files.

Why a series? The program makes an odd assumption that makes sense once you think about it. Since the headers are automatically generated, it doesn’t make sense to reuse the headers. Instead, each source file gets its own customized header file. The program puts in what is necessary and in the right order. So A.c will use A.h and B.c will use B.h. There won’t be any cross-dependency between the two headers. If something changes, you simply run the program again to regenerate the header files.

What Gets Copied?

Here’s what the documentation says gets copied into header files:

  • When a function is defined in any .c file, a prototype of that function is placed in the generated .h file of every .c file that calls the function. If the “static” keyword of C appears at the beginning of the function definition, the prototype is suppressed. If you use the “LOCAL” keyword where you would normally say “static”, then a prototype is generated, but it will only appear in the single header file that corresponds to the source file containing the function. However, no other generated header files will contain a prototype for the static function since it has only file scope. If you invoke makeheaders with a “-local” command-line option, then it treats the “static” keyword like “LOCAL” and generates prototypes in the header file that corresponds to the source file containing the function definition.
  • When a global variable is defined in a .c file, an “extern” declaration of that variable is placed in the header of every .c file that uses the variable.
    When a structure, union, or enumeration declaration or a function prototype or a C++ class declaration appears in a manually produced .h file, that declaration is copied into the automatically generated .h files of all .c files that use the structure, union, enumeration, function or class. But declarations that appear in a .c file are considered private to that .c file and are not copied into any automatically generated files.
  • All #defines and typedefs that appear in manually produced .h files are copied into automatically generated .h files as needed. Similar constructs that appear in .c files are considered private to those files and are not copied. When a structure, union, or enumeration declaration appears in a .h file, makeheaders will automatically generate a typedef that allows the declaration to be referenced without the “struct”, “union” or “enum” qualifier.

Note that the tool can tell when a header is one it produces, so you don’t have to exclude them from the input files.

A C++ Example

For things like C++ classes — or anything, really — you can enclose a block of code inside a special preprocessor directive to make the tool process it. Here’s a very simple example I used to test things out:

A few things to notice. First, the include for test.hpp will grab the generated header file specific to this file. The INTERFACE directive wraps the code that should be in the header. At compile time, INTERFACE will equal zero, so this code won’t compile twice.

The member functions declared outside of the INTERFACE section have PUBLIC in front of them (and could, of course, have PRIVATE or PROTECTED, as well). This will cause the tool to pick them up. Finally, notice that there is a global variable and a global function at the bottom of the file.

Notice that when using PUBLIC or the other keywords that you omit the functions from the declaration. The only reason the example has some functions there is because they are inline. If you put all the functions outside the interface section of the file, the generated header will correctly assemble the class declaration. In this case, it will add these functions to the ones that are already there.

The Generated Header

The header seems pretty normal. You might be surprised that the header isn’t wrapped with the usual preprocessor statements that prevent the file from being included more than once. After all, since only one file will include the header, that code is unnecessary.

Here’s the file:

Notice that INTERFACE gets set to zero at the end, which means in the source file, the interface portion won’t get compiled again. For C source, the tool also generates typedefs for things like structures. For C++ this is unnecessary, of course. You can see the byproduct of having some declarations in the interface section and some in the implementation section: there is a redundant public tag. This is harmless and wouldn’t appear if I had put all the code outside the interface section.

There’s More

There’s more that this versatile tool can do, but you can read the documentation. There’s a flag that dumps information about your code you can use for documentation purposes. You can build hierarchies of interfaces. It also can help you mix C++ and C code. The tool is smart enough to handle conditional compilation. Note, though, that the C++ support doesn’t handle things like templates and namespaces. You have the source, though, so you could fix that if you like. There are some other limitations you should read about before you adopt this for a big project.

Will you try a tool like this or are you happy with manually handling headers? C++ can even target web pages. Or, use it for shell scripts, if you dare.

]]>
https://hackaday.com/2021/11/08/linux-fu-automatic-header-file-generation/feed/ 22 503297 LinuxFu
OpenChronograph Lets You Roll Your Own Smart Watch https://hackaday.com/2020/02/26/openchronograph-lets-you-roll-your-own-smart-watch/ https://hackaday.com/2020/02/26/openchronograph-lets-you-roll-your-own-smart-watch/#comments Thu, 27 Feb 2020 00:00:46 +0000 https://hackaday.com/?p=400416 At first, smartwatches were like little tiny tablets or phones that you wore on your wrist. More recently though we have noticed more “hybrid” smartwatches, that look like a regular …read more]]>

At first, smartwatches were like little tiny tablets or phones that you wore on your wrist. More recently though we have noticed more “hybrid” smartwatches, that look like a regular watch, but that use their hands to communicate data. For example you might hear a text message come in and then see the hand swing to 1, indicating it is your significant other. Want to roll your own? The OpenChronograph project should be your first stop.

The watches are drop in replacements for several Fossil and Skagen watch boards (keep in mind Fossil and Skagen are really the same company). There’s an Arduino-compatible Atmega328p, an ultra low power real time clock, a magnetometer, pressure sensor, temperature sensor, and support for a total of three hands. You can even create PCB artwork that will act as the watch face using Python.

You can see a video of how you’d replace an existing watch’s PCB with the new version. You’ll also need a special tiny POGO pin programmer since there isn’t much room in the little case.

Honestly, opening the watch looked a little frightening to us, but at least the hybrid watches aren’t usually that expensive. You can usually find a Hagen or a Men’s Machine for under $100. A Fossil Q Activist looks as though it might come in at just a little bit more.

Of course, you could skip the existing watch and build one all the way. Some are easier to build than others.

]]>
https://hackaday.com/2020/02/26/openchronograph-lets-you-roll-your-own-smart-watch/feed/ 32 400416 watch
Hiring From a Makerspace Pays Off https://hackaday.com/2019/11/07/hiring-from-a-makerspace-pays-off/ https://hackaday.com/2019/11/07/hiring-from-a-makerspace-pays-off/#comments Thu, 07 Nov 2019 12:00:00 +0000 https://hackaday.com/?p=384186 A makerspace is a great place to use specialty tools that may be too expensive or large to own by oneself, but there are other perks that come with participation …read more]]>

A makerspace is a great place to use specialty tools that may be too expensive or large to own by oneself, but there are other perks that come with participation in that particular community. For example, all of the skills you’ve gained by using all that fancy equipment may make you employable in some very niche situations. [lukeiamyourfather] from the Dallas Makerspace recently found himself in just that situation, and was asked to image a two-million-year-old fossil.

The fossil was being placed into a CT machine for imaging, but was too thick to properly view. These things tend to be fragile, so he spent some time laser cutting an acrylic stand in order to image the fossil vertically instead of horizontally. Everything that wasn’t fossil had to be non-conductive for the CT machine, so lots of fishing line and foam was used as well. After the imaging was done, he was also asked to 3D print a model for a display in the museum.

This is all going on at the Perot Museum of Nature and Science if you happen to be in the Dallas area. It’s interesting to see these skills put to use out in the wild as well, especially for something as rare and fragile as studying an old fossil. Also, if you’d like to see if your local makerspace measures up to the Dallas makerspace, we featured a tour of it back in 2014, although they have probably made some updates since then.

]]>
https://hackaday.com/2019/11/07/hiring-from-a-makerspace-pays-off/feed/ 12 384186 fossil-scan-main