Skip to content

Instantly share code, notes, and snippets.

View theteachr's full-sized avatar
👨‍💻
Teaching

Nick theteachr

👨‍💻
Teaching
View GitHub Profile
@theteachr
theteachr / settings.json
Last active July 27, 2023 13:21
VSCode Vim Bindings
{
"vim.normalModeKeyBindingsNonRecursive": [
{
"before": [
"<leader>",
"s"
],
"commands": [
"workbench.action.gotoSymbol"
],
@theteachr
theteachr / rev.c
Last active January 28, 2023 11:54
Destructive XOR
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define MAX_CHARS 64
void swap(char* a, char* b) {
*a = *a ^ *b;
*b = *a ^ *b;
*a = *a ^ *b;
@theteachr
theteachr / bitshift.py
Last active September 4, 2022 22:24
Playing with overload ops to get fp features in Python
class BitShiftFunc:
def __init__(self, f):
self.f = f
def __lshift__(self, rhs):
return self.f(rhs)
def __rrshift__(self, lhs):
return self.f(lhs)
@theteachr
theteachr / main.c
Last active July 1, 2022 12:21
Compiler Optimization Behavior: Short Circuiting
#include <stdio.h>
#include <stdlib.h>
struct Reeds {
int store;
};
int main(void) {
struct Reeds* r = NULL;
// r = malloc(sizeof(struct Reeds));