Skip to content

Instantly share code, notes, and snippets.

View navin-mohan's full-sized avatar

Navin Mohan navin-mohan

View GitHub Profile
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
#define TAB_SIZE 100
#define SYMBOL_SIZE 30
#define OPCODE_SIZE 10
@navin-mohan
navin-mohan / symtab.c
Last active November 14, 2017 15:02
symtab complete
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
#define SYMTAB_SIZE 100
#define SYMBOL_SIZE 30
typedef unsigned int uint;
@navin-mohan
navin-mohan / dining_philosophers.c
Created October 22, 2017 18:14
Dining Philosophers problem in C
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <string.h>
#include <unistd.h>
#include <pthread.h>
/*
use the pthread flag with gcc to compile this code
~$ gcc -pthread dining_philosophers.c -o dining_philosophers
@navin-mohan
navin-mohan / producer_consumer.c
Last active June 6, 2024 19:09
Producer-Consumer problem in C using semaphores
// MIT License
// Copyright (c) 2022 Navin Mohan
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
@navin-mohan
navin-mohan / mec_proxy_apt.conf
Created August 25, 2017 05:26
Apt conf for mec proxy
# /etc/apt/apt.conf
Acquire::http::Proxy "http://mec:mec@192.168.0.4:3128";
@navin-mohan
navin-mohan / Sources.list
Created August 18, 2017 17:38
Debian sources
#------------------------------------------------------------------------------#
# OFFICIAL DEBIAN REPOS
#------------------------------------------------------------------------------#
###### Debian Main Repos
deb http://deb.debian.org/debian/ stable main contrib non-free
deb-src http://deb.debian.org/debian/ stable main contrib non-free
deb http://deb.debian.org/debian/ stable-updates main contrib non-free
deb-src http://deb.debian.org/debian/ stable-updates main contrib non-free
@navin-mohan
navin-mohan / codeblocks.md
Last active August 15, 2017 10:19
CodeBlocks

Installing CodeBlocks

On Windows XP / Vista / 7 / 8.x / 10

Download the installer from any of the links below.

It includes both the compiler(gcc) and IDE.

Ubuntu

@navin-mohan
navin-mohan / helper_functions.py
Last active June 11, 2017 10:45
Helper Functions for ML
# Python 3
import numpy as np
from PIL import Image
from io import BytesIO
from IPython import display
def split_test_train(dataset,percent):
'''Randomly splits the data set into test and train sets'''
@navin-mohan
navin-mohan / SimpleCalc.java
Created June 4, 2017 16:45
Calculator Applet using AWT Java
import java.awt.*;
import java.awt.event.*;
import java.applet.Applet;
public class SimpleCalc extends Applet{
private Label xInputLabel,yInputLabel;
private Label statusLabel;
private Panel xInputPanel;
@navin-mohan
navin-mohan / WordCount.java
Last active June 4, 2017 14:01
Count the number of words in a file using Regex in Java
import java.util.Scanner;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.io.*;
public class WordCount{
public static void main(String[] args) {