Skip to content

Instantly share code, notes, and snippets.

View OkiStuff's full-sized avatar
🛩️
Student Pilot

Frankie A OkiStuff

🛩️
Student Pilot
View GitHub Profile
# Needed Things
SwitchBru DNS Server IP: 45.55.142.122
in progress of making
void update_navbar(navbar* bar, Applet* self)
{
// This trash code should only make it so an event is called once and never called again until a different event has occurred.
for (int i = 0; i < ARRAY_LENGTH(bar->components); i++)
{
int hover_once = 0;
int normal_once = 0;
if (CHECK_COLLISION_POINT_REC(get_mouse_position_vec2(self), bar->components[i]->box))
void clean_box_handle(int event, widget* self)
{
switch (event)
{
case HOVER:
clean_box_animation = 2;
break;
case PRESSED:
clean_box_animation = 1;
@OkiStuff
OkiStuff / switch.py
Last active January 2, 2022 02:57
DIY Switch statement tutorial in Python
# This is an example of switch statements in Python
# Switch statements are not a part of libpython (my nickname for the python standard library) or the Python Language Standard
# But they are very easy to DIY, and they improve readability, and performance!!
# Lets say we want to return the age for a passed name
def get_age(name):
# You might think to start writing if statements, and for something small, that is fine. But they can get real messy and hard to edit
# Let's use a DIY switch statement instead!!!
switch = {
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define MAX_ASSET_TITLE_SIZE 256
#define MAX_ASSET_TABLE_SIZE 50
unsigned int __hash(const char *title)
{
int len = strnlen(title, MAX_ASSET_TITLE_SIZE);
from io import TextIOWrapper
from sys import stdout, stderr
from time import gmtime
import typing as t
class ScrawpDebugger:
def __init__(self, out : t.Optional[TextIOWrapper] = stdout, err : t.Optional[TextIOWrapper] = stderr, log : t.Optional[TextIOWrapper] = None) -> None:
self.io_out : TextIOWrapper = out
self.io_err : TextIOWrapper = err

Error Correction

Parity is a bit that says if a string of binary should have an even or odd amount of ones

  • 0 is even
  • 1 is odd

Hamming Distance

Hamming Distance is (in this context) basically the amount of bits need to be flipped until error detection fails

Example