Skip to content

Instantly share code, notes, and snippets.

View FreeER's full-sized avatar

Benjamin Clements FreeER

View GitHub Profile
@FreeER
FreeER / seven_segment_595_shift_register_testing.ino
Created September 8, 2022 12:49
playing around with a seven segment display and a 74HC595N shift register from the elegoo mega 2560 kit
// https://www.ti.com/lit/ds/symlink/sn74hc595.pdf?ts=1662270700415
// https://www.youtube.com/watch?v=Ys2fu4NINrA
// https://lastminuteengineers.b-cdn.net/wp-content/uploads/arduino/7-Segment-Common-Anode-Common-Cathode-Pinout.png
enum { OE = 8,
LATCH = 10,
CLK = 11,
SER /*serial*/ = 12 };
#define BUTTON 13
enum { A = 128,
B = 1,
@FreeER
FreeER / Polytopia.ct
Last active August 6, 2020 18:05
Cheat Table for Polytopia initial release to change zoom
<?xml version="1.0" encoding="utf-8"?>
<CheatTable CheatEngineTableVersion="31">
<CheatEntries>
<CheatEntry>
<ID>1</ID>
<Description>"Find Zoom"</Description>
<Options moHideChildren="1" moDeactivateChildrenAsWell="1"/>
<LastState Activated="1"/>
<VariableType>Auto Assembler Script</VariableType>
<AssemblerScript>{$lua}
@FreeER
FreeER / VS debugging bit patterns
Last active April 8, 2019 21:08
VS debugging bit patterns
source: https://www.softwareverify.com/memory-bit-patterns.php
0xCCCCCCCC uninitialised stack memory
0xCDCDCDCD uninitialised heap memory (malloc(), realloc() or new)
0xDDDDDDDD deallocated memory (free() or delete).
0xFEEEFEEE part of a deallocated memory allocation (free() or delete).
0xBAADF00D uninitalized HeapAlloc(), LocalAlloc(LMEM_FIXED), GlobalAlloc(GMEM_FIXED).
0xDEADBEEF memory deallocated using HeapFree(), LocalFree(), GlobalFree().
0xABABABAB guard block after memory allocated using HeapAlloc(), LocalAlloc(LMEM_FIXED), GlobalAlloc(GMEM_FIXED) or CoTaskMemAlloc().
0xBDBDBDBD guard pattern around memory allocations allocated with the "aligned" allocators
@FreeER
FreeER / Functions in C.md
Last active January 10, 2019 13:30
Comprehensive explanation of functions in C

can you guys recommend a good, comprehensive explanation of functions that goes beyond writing a function that adds two integers? More examples would be nice.

A function is a way to name a piece of code and reuse it with different values. The most basic example is something like... ah... I can't think of any examples off the top of my head that don't take or return anything right now but let's say closing the program and pretend it doesn't take anything. It might be a lot of code and you don't really care how it works just what it does eg. exit(); As an example of more than just a simple name imagine calculating the volume of a rectangular box:

int width = 53;
int height = 24;
int length = 32;
int volume = width * height * length;