Skip to content

Instantly share code, notes, and snippets.

View ankurs's full-sized avatar

Ankur Shrivastava ankurs

View GitHub Profile
@ankurs
ankurs / movietime.c
Created November 13, 2011 18:17
Watch movie without screen getting locked
#include<X11/Xlib.h>
#include<X11/Xutil.h>
#include<X11/keysym.h>
#include<unistd.h>
#define DURATION 100
int main()
{
Display *display = NULL;
@ankurs
ankurs / poll.h
Created March 12, 2011 21:19
epoll wrapper
#ifndef _POLL_H
#define _POLL_H
#include "hash_table/hashtable.h"
#include <sys/epoll.h>
#define MAX_EVENTS 100
#define CALLBACK(x) void (*x) (poll_event_t *, poll_event_element_t *, struct epoll_event)
#define ACCEPT_CB 0x01
@ankurs
ankurs / Makefile
Created March 11, 2011 13:59
a simple hash table implementation
CC = gcc -fPIC
LDFLAGS = -lm
# set DEBUG options
ifdef DEBUG
CFLAGS = -Wall -Wextra -ggdb -pg -DDEBUG
else
CFLAGS = -Wall -O2
endif
\documentclass[11pt]{book}
\usepackage{graphicx}
\usepackage[empty]{fullpage}
\author{Ankur Shrivastava}
\begin{document}
\frontmatter
\begin{center}
\textbf{\LARGE RING}\\
\vspace{40ex}
A mini project report submitted to\\
@ankurs
ankurs / fsm.c
Created April 4, 2010 21:15
FSM in C
/**
* @file fsm.c
* @brief an implementation for a FSM in C, this file contains
* implementation of definations.
* License GPLv3+
* @author Ankur Shrivastava
*/
#include "fsm.h"
#include<stdlib.h>
/*
* Initial implementation of a HTTP server, this is just a test which
* only manages GET request for file names
* Author: Ankur Shrivastava
* Licence: GPLv3+
*/
#include<unistd.h>
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
/* Initial implementation for a folder lock
* Author: Ankur Shrivastava
* License: GPLv3
*/
import java.io.*;
import java.util.Enumeration;
import java.util.zip.*;
import javax.crypto.Cipher;
import javax.crypto.CipherOutputStream;
@ankurs
ankurs / lcd.asm
Created October 4, 2009 19:29
lcd test code for JHD 162a
; lcd test code for JHD 162a
; Author :- Ankur Shrivastava
; License : GPLv3
; RS - > set it to port pin connected to RS pin of LCD
; R/W -> set it to port pin connected to R/W pin of LCD
; E -> set it to port pin connected to E pin of LCD
; DAT -> set it to port connected to Data pins of LCD
RS EQU P1.2
@ankurs
ankurs / thread.c
Created September 2, 2009 15:50
A Simple Pthread example
#include<pthread.h>
#include<stdio.h>
// a simple pthread example
// compile with -lpthreads
// create the function to be executed as a thread
void *thread(void *ptr)
{
int type = (int) ptr;
fprintf(stderr,"Thread - %d\n",type);
## python socket chat example
## author: Ankur Shrivastava
## licence: GPL v3
#server
import socket
import threading
import time
SIZE = 4