Skip to content

Instantly share code, notes, and snippets.

View goswami-rahul's full-sized avatar
💻
zen

Rahul Goswami goswami-rahul

💻
zen
  • Google
  • India
View GitHub Profile
@goswami-rahul
goswami-rahul / deadline_monotonic.cpp
Created September 11, 2018 11:58
RTS Scheduler - Rate Monotonic & Deadline Monotonic
/*
~ Rahul Goswami
*/
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n;
cout << "Enter the number of tasks: ";
#include<bits/stdc++.h>
using namespace std;
int lcm(int a, int b) {
return (a * b) / __gcd(a, b);
}
int main() {
cout << "Enter the number of total processes: ";
int n;
cin >> n;
@goswami-rahul
goswami-rahul / draw_circle.cpp
Created August 20, 2018 10:13
Draw circle using graphics.h in C++.
r = 50, cx = 150, cy = 200;
p = 1 - r;
x = 0; y = r;
while (x <= y) {
putpixel(x + cx, y + cy, RED);
putpixel(y + cx, x + cy, RED);
putpixel(-x + cx, y + cy, RED);
putpixel(-y + cx, x + cy, RED);
/*putpixel(x + cx, -y + cy, RED);
putpixel(y + cx, -x + cy, RED);
@goswami-rahul
goswami-rahul / cyclic_scheduler.cpp
Created August 14, 2018 11:49
Real Time System, Lab - 2
#include<bits/stdc++.h>
using namespace std;
int lcm(int a, int b) {
return (a * b) / __gcd(a, b);
}
int main() {
cout << "Enter the number of total processes: ";
int n;
cin >> n;
#include<bits/stdc++.h>
using namespace std;
int lcm(int a, int b) {
return a * b / __gcd(a, b);
}
int main() {
cout << "Enter the number of tasks: ";
int n;
@goswami-rahul
goswami-rahul / model_train.py
Last active June 8, 2018 17:26
here's the model i used for training.
import numpy as np
import matplotlib.pyplot as plt
import cv2
from scipy import stats
np.random.seed(123) # for reproducibility
from skimage.restoration import denoise_bilateral
from keras.models import Sequential
from keras.layers import Dense, Dropout, Activation, Flatten
from keras.layers import MaxPooling2D, Conv2D
@goswami-rahul
goswami-rahul / algorithm.cpp
Last active April 15, 2018 13:53
C++ 14 algorithm to find the nodes in the diameter of the tree, and nodes not included in the diameter of the tree.
/*
* @author - Rahul Goswami
* 15 Apr, 2018
*/
#include<bits/stdc++.h>
using namespace std;
#define N 10
vector<int> adj[N];
int max_distance, farthest_node;
@goswami-rahul
goswami-rahul / bankers-algo.py
Created March 11, 2018 12:26
A Python script to check if a system is safe or not, and print the safe order if it is safe.
#!/usr/bin/python3
"""
@author - Rahul Goswami
run as:
python3 bankers-alogorithm.py
Output:
Enter the number of processes (n): 5