Skip to content

Instantly share code, notes, and snippets.

View markasoftware's full-sized avatar
👽
secret alien technology

Mark Polyakov markasoftware

👽
secret alien technology
View GitHub Profile
@fay59
fay59 / Quirks of C.md
Last active January 23, 2024 04:24
Quirks of C

Here's a list of mildly interesting things about the C language that I learned mostly by consuming Clang's ASTs. Although surprises are getting sparser, I might continue to update this document over time.

There are many more mildly interesting features of C++, but the language is literally known for being weird, whereas C is usually considered smaller and simpler, so this is (almost) only about C.

1. Combined type and variable/field declaration, inside a struct scope [https://godbolt.org/g/Rh94Go]

struct foo {
   struct bar {
 int x;
@maddox
maddox / rolling-stones-500-greatest-albums-of-all-time.md
Created July 22, 2015 15:31
Rolling Stone's 500 Greatest Albums of All Time
@leommoore
leommoore / file_magic_numbers.md
Last active May 17, 2024 18:26
File Magic Numbers

File Magic Numbers

Magic numbers are the first bits of a file which uniquely identify the type of file. This makes programming easier because complicated file structures need not be searched in order to identify the file type.

For example, a jpeg file starts with ffd8 ffe0 0010 4a46 4946 0001 0101 0047 ......JFIF.....G ffd8 shows that it's a JPEG file, and ffe0 identify a JFIF type structure. There is an ascii encoding of "JFIF" which comes after a length code, but that is not necessary in order to identify the file. The first 4 bytes do that uniquely.

This gives an ongoing list of file-type magic numbers.

Image Files

{
"1": "7642c4c2e24b176ed442153e3097e819bf5ca80e",
"2": "b3d784bbaf1286612ad44308231aa58350da17a6",
"3": "a05cb173c1ba1c6ae30bcf5edbd5d5e19566e764",
"4": "55d264f8671b50b5dbaffa56d1ee719fd429e8f4",
"5": "478ec952d186329f825db4ee7978e31dd42de622",
"6": "e82bd73e8c188d151ed790b5ad5a24fa01533fa0",
"7": "28a9dfb84ef81592f21ed285d7cf09be0b605988",
"8": "e98c13fc9df6a893efa0c57bcfa548be664ab8c8",
"9": "af316e6df5bded14f9b268fcbffe7892eb5f244c",