Skip to content

Instantly share code, notes, and snippets.

View nickedes's full-sized avatar

Nikhil Mittal nickedes

  • Bangalore, India
View GitHub Profile
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define WIDTH 600
#define HEIGHT 600
#include <GLUT/glut.h>
#include <GLUT/glut.h> // glut (gl utility toolkit) basic windows functions, keyboard, mouse.
#include <stdio.h> // standard (I/O library)
#include <stdlib.h> // standard library (set of standard C functions
#include <math.h> // Math library (Higher math functions )
#include <string.h>
// lighting
GLfloat LightAmbient[]= { 0.5f, 0.5f, 0.5f, 1.0f };
GLfloat LightDiffuse[]= { 0.5f, 0.5f, 0.5f, 1.0f };
GLfloat LightPosition[]= { 5.0f, 25.0f, 5.0f, 1.0f };
@nickedes
nickedes / cubes_gl.cpp
Last active August 29, 2015 14:27 — forked from dufferzafar/cubes_gl.cpp
Cube Zoom In - Zoom Out with OpenGL
#include <GL/glut.h>
static float zoom_factor = 0.5;
float ver[8][3] =
{
{-0.5 , -0.5 , 0.5} ,
{-0.5 , 0.5 , 0.5} ,
{0.5 , 0.5 , 0.5} ,
{0.5 , -0.5 , 0.5} ,
@nickedes
nickedes / balls_gl.cpp
Last active August 29, 2015 14:27 — forked from dufferzafar/balls_gl.cpp
Ball Collisions with OpenGL. 1 -> 2 -> 1
#define GLUT_DISABLE_ATEXIT_HACK
#include <windows.h>
#include <gl\glut.h>
#include <iostream>
float x1=-2.0, x2=2.0;
static int flag=1;
static int i=0;
@nickedes
nickedes / ball_on_line_gl.cpp
Last active August 29, 2015 14:27 — forked from dufferzafar/ball_on_line_gl.cpp
Control a ball on a line with Left & Right Keys using OpenGL
#define GLUT_DISABLE_ATEXIT_HACK
#include <windows.h>
#include <iostream>
#include <gl\glut.h>
// Initial Position of the Ball
float x_position = 0.0;
float y_position = 0.0;
// Radius of ball
@nickedes
nickedes / rsa.py
Last active August 29, 2015 14:19 — forked from anonymous/rsa.py
import random
from itertools import count
# Extended Euclidean Algorithm
def egcd(a, b):
x,y, u,v = 0,1, 1,0
while a != 0:
q, r = b//a, b%a
m, n = x-u*q, y-v*q
b,a, x,y, u,v = a,r, u,v, m,n
@nickedes
nickedes / client.py
Last active August 29, 2015 14:17 — forked from dufferzafar/client.py
import sys
from socket import socket, AF_INET, SOCK_DGRAM
SERVER_IP = '127.0.0.1'
PORT_NUMBER = 5000
SIZE = 1024
print("Test client sending packets to IP {0}, via port {1}\n".format(SERVER_IP, PORT_NUMBER))
mySocket = socket(AF_INET, SOCK_DGRAM)