Skip to content

Instantly share code, notes, and snippets.

View faraazahmad's full-sized avatar
🏠
Working from home

Syed Faraaz Ahmad faraazahmad

🏠
Working from home
View GitHub Profile
@faraazahmad
faraazahmad / boot.asm
Last active July 6, 2017 16:16
error on make
global start
section .text
bits 32
start:
; point the first entry of the level 4 page table
; to the first entry in level 3 page table
mov eax, p3_table
or eax, 0b11
mov dword [p4_table + 0], eax
@faraazahmad
faraazahmad / naive.py
Last active December 28, 2017 14:18
Simple pseudocode for naive recirsive fibonacci algorithm
def naive_fib(n):
if n >= 0 and n <= 1:
return n
else:
return naive_fib(n - 1) + naive_fib(n - 2)
@faraazahmad
faraazahmad / better.py
Created December 28, 2017 14:20
an optimised fibonacci generating algorithm using memoisation
def better_fib(n):
if n >= 0 and n <= 1:
return n
else:
fib = [0, 1]
for i in range(2, n + 1):
fib.append(fib[i - 1] + fib[i - 2])
return fib[n]
Verifying my Blockstack ID is secured with the address 1FXLzWj12rY4uuvwrLzFJPmbkjii72Q27k https://explorer.blockstack.org/address/1FXLzWj12rY4uuvwrLzFJPmbkjii72Q27k
@faraazahmad
faraazahmad / 4bitcounter.c
Created February 6, 2019 06:11
Embedded lab #3
#include <p89v51rx2.h>
void delay(unsigned int dela)
{
unsigned int i,j;
for(i=0;i<=1000;i++)
for(j=0;j<=dela;j++);
}
@faraazahmad
faraazahmad / counter_buzzer.c
Created February 20, 2019 06:07
counter_buzzer
#include <p89v51rx2.h>
sbit buzzer = P0^3;
sbit l1 = P3^0;
sbit l2 = P3^1;
sbit l3 = P3^6;
sbit l4 = P3^7;
sbit s1 = P3^2;
@faraazahmad
faraazahmad / switch_counter.c
Created February 26, 2019 14:23
switch_counter
#include <p89v51rx2.h>
sbit l1 = P3^0;
sbit l2 = P3^1;
sbit l3 = P3^6;
sbit l4 = P3^7;
sbit s1 = P3^2;
sbit s2 = P3^3;
sbit s3 = P3^4;
@faraazahmad
faraazahmad / lcd_switch_counter.c
Created February 27, 2019 06:45
lcd switch counter
#include <LCD.h>
sbit l1 = P3^0;
sbit l2 = P3^1;
sbit s1 = P3^2;
sbit s2 = P3^3;
sbit s4 = P3^5;
void counter_3(){
@faraazahmad
faraazahmad / lcd.c
Created February 27, 2019 06:46
lcd
#include <LCD.h>
/*
#define display_port P2 //Data pins connected to port 2 on microcontroller
sbit rs = P3^2; //RS pin connected to pin 2 of port 3
sbit rw = P3^3; // RW pin connected to pin 3 of port 3
sbit e = P3^4; //E pin connected to pin 4 of port 3
void msdelay(unsigned int time) // Function for creating delay in milliseconds.
{
#include <LCD.h>
sbit IR=P1^0;
// intuitive code
void main()
{
LCD_INIT();
while(1) {
if(IR == 0) {