This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"bufio" | |
"flag" | |
"fmt" | |
"os" | |
"unicode" | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
provider "aws" { | |
region = "us-east-1" | |
} | |
## Using variables | |
variable "ami_id" { | |
type = string | |
default = "ami-09d56f8956ab235b3" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"math" | |
"regexp" | |
"strconv" | |
"testing" | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <stdlib.h> | |
template <typename T> | |
struct Node{ | |
T data; | |
Node* next; | |
}; | |
// template: used for passing data-type as a parameter |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"math" | |
) | |
type QueueNode struct { | |
value interface{} | |
priority int |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
) | |
type QueueNode struct { | |
value interface{} | |
priority int | |
next *QueueNode |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
) | |
type QueueElement struct { | |
value interface{} | |
priority int | |
} |
NewerOlder