Skip to content

Instantly share code, notes, and snippets.

View rexsimiloluwah's full-sized avatar
💭
I may be slow to respond.

Similoluwa Okunowo rexsimiloluwah

💭
I may be slow to respond.
View GitHub Profile
@rexsimiloluwah
rexsimiloluwah / aoc2023-day1-solution.go
Created December 1, 2023 17:56
My (not so elegant) full solution to AOC 2023 day 1 problem using Go
package main
import (
"bufio"
"flag"
"fmt"
"os"
"unicode"
)
provider "aws" {
region = "us-east-1"
}
## Using variables
variable "ami_id" {
type = string
default = "ami-09d56f8956ab235b3"
}
package main
import (
"fmt"
"math"
"regexp"
"strconv"
"testing"
)
#include <iostream>
#include <stdlib.h>
template <typename T>
struct Node{
T data;
Node* next;
};
// template: used for passing data-type as a parameter
@rexsimiloluwah
rexsimiloluwah / anti_eye.m
Last active March 16, 2022 22:58
Generate an nxn anti-diagonal matrix
%The default state-space representation in MATLAB is the controller canonical representation
%An anti-diagonal matrix (P) is useful for transforming the controller canonical repr. into a phase-variable repr.
%Where A_p=inv(P)*A_c*P, B_p=inv(P)*B_c, C_p=C_c*P, D_p=D_c
%Generate an nxn anti-diagonal matrix
function [diag] = anti_eye(n)
assert(n>1, 'n must be greater than 1');
diag = eye(n);
%use two pointers
for i=1:floor(n/2)
p1 = i;
@rexsimiloluwah
rexsimiloluwah / 523_assignment_2_rel_curve.m
Created February 12, 2022 21:26
EEE523 Assignment 2 - Reliability curve for System A and B
syms k t;
k = 0.03; %k = failure rate
% t = 100 hours
fplot(@(t) exp(-4*k*t)-4*exp(-3*k*t)+4*exp(-2*k*t),[0 100],'LineWidth',2)
hold on
fplot(@(t) 2*exp(-2*k*t)-exp(-4*k*t),[0 100],'LineWidth',2)
grid on
legend('RsysA','RsysB')
title('Reliability plot for system A and B')
xlabel('Time')
@rexsimiloluwah
rexsimiloluwah / nodemcu_google_assistant.ino
Last active April 10, 2023 18:01
Simple code for controlling NodeMCU GPIOs using Google Assistant, AdaFruit and IFTTT
// Requirements
// 1. AdaFruit feed created (green_led_status in this case)
// 2. IFTTT connection for Google Assistant to that Adafruit feed
#include <ESP8266WiFi.h>
#include <Adafruit_MQTT.h>
#include <Adafruit_MQTT_Client.h>
#define ssid "RWERouter1"
#define password "rwe12345"
#define AIO_MQTT_SERVER "io.adafruit.com" // Adafruit MQTT server
package main
import (
"fmt"
"math"
)
type QueueNode struct {
value interface{}
priority int
package main
import (
"fmt"
)
type QueueNode struct {
value interface{}
priority int
next *QueueNode
package main
import (
"fmt"
)
type QueueElement struct {
value interface{}
priority int
}