Skip to content

Instantly share code, notes, and snippets.

View michaelfm1211's full-sized avatar

Michael M. michaelfm1211

  • 23:26 (UTC -05:00)
View GitHub Profile
@michaelfm1211
michaelfm1211 / totp-copy.sh
Created June 26, 2022 03:19
scripts for use with my TOTP cli app
# helper script to the xbar plugin
# copy this somewhere meaningful, then change TOTP_COPY variable in the plugin
#!/bin/sh
/Users/michaelmcnulty/Desktop/compilers/bin/totp -r "$1" | pbcopy
@michaelfm1211
michaelfm1211 / Makefile
Last active July 27, 2023 01:26
generic makefile for simple c projects
SRCS := $(wildcard *.c)
OBJS := $(SRCS:.c=.o)
PROG_NAME := example_placeholder
CFLAGS += -Wall -Wextra -c
LDFLAGS +=
# Production
.PHONY: all
all: CLFAGS += -O2
@michaelfm1211
michaelfm1211 / helloworld.cpp
Last active July 4, 2022 04:30
like my idiomatic oop & c++ skills?
#include <iostream>
class HelloSayer {
private:
std::string greeting;
std::string name;
std::string makeMessage() {
return this->greeting + ", " + this->name + "!";
}
@michaelfm1211
michaelfm1211 / authenticated.html
Created July 13, 2022 00:04
JS Boilerplate for Sign-in with Google
<!DOCTYPE html>
<html>
<head>
<title>Authenticated</title>
</head>
<body>
<script type="text/javascript">
const url_string = window.location.href;
const url_string_mod = url_string.split("#");
elt usm = "";
@michaelfm1211
michaelfm1211 / cowsay.c
Last active September 5, 2022 02:58
cowsay CGI in C (tested with fastcgi+nginx)
/*
ISC License
Copyright 2022 Michael M.
Permission to use, copy, modify, and/or distribute this software for any purpose
with or without fee is hereby granted, provided that the above copyright notice
and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
@michaelfm1211
michaelfm1211 / styles.css
Created September 5, 2022 02:59
my general purpose css styles
/*
Michael's General Purpose CSS Styles.
*/
/*
ISC License
Copyright 2022 Michael M.
Permission to use, copy, modify, and/or distribute this software for any purpose
@michaelfm1211
michaelfm1211 / marquee.c
Last active September 25, 2022 23:04
C program that simulates the (deprecated) HTML <marquee> tag
#include <signal.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/ioctl.h>
#include <unistd.h>
bool rflag = false;
float speed = 0.05;
@michaelfm1211
michaelfm1211 / mouse-totp.py
Last active September 25, 2022 23:15
pyusb script to use an extra USB mouse with my totp program
# adapted from https://www.orangecoat.com/how-to/read-and-decode-data-from-your-mouse-using-this-pyusb-hack
# requirements:
# - macOS (although it may be adapted for linux)
# - pyusb (https://pypi.org/project/pyusb/)
# - my totp program (https://github.com/michaelfm1211/totp). you might be able to use another totp program
# - the accompanying totp-copy.sh (https://gist.github.com/michaelfm1211/32336940e1d27c4b2a44c9e3f665f26c). again, may be adapted for linux
# - terminal-notifier (https://github.com/julienXX/terminal-notifier). not stricly needed, but nice to have
import atexit
@michaelfm1211
michaelfm1211 / poly.c
Last active September 26, 2022 14:12
simply polymorphic C program that changes it's own binary
// this program has been tested on macOS and Alpine Linux, but not Windows. Both
// GCC Clang and GNU GCC have also been tested to work. Ideally, this program
// should work on any x86-64 machine.
//
// the program assumes it's binary is called "poly", so you must change the
// source code if you want to rename the executable to anything else.
#include <arpa/inet.h>
#include <stdio.h>
#include <stdlib.h>
@michaelfm1211
michaelfm1211 / graph.py
Last active November 23, 2022 03:35
highly experimental and useless graphing program
from PIL import Image
from math import ceil
# these variables are not used everywhere and some parts just assume that they are both (100, 100).
# change at your own risk.
scale = (100, 100)
res = (100, 100)