Skip to content

Instantly share code, notes, and snippets.

View basavesh's full-sized avatar
👨‍💻

Basavesh Ammanaghatta Shivakumar basavesh

👨‍💻
View GitHub Profile
@basavesh
basavesh / RSA.py
Created October 13, 2012 18:06 — forked from avalonalex/RSA.py
A implementation of RSA public key encryption algorithms in python
import random
import math
import copy
def euclid(a,b):
'''returns the Greatest Common Divisor of a and b'''
a = abs(a)
b = abs(b)
@basavesh
basavesh / DoubleNode.java
Created November 9, 2012 08:33
DoubleNode.java
package edu.cmu.cs771.hw1;
/**
* The class DoubleNode holds two pointers and a character. It is used to represent a single node on a double linked list.
* @author songluo
*
*/
public class DoubleNode {
private DoubleNode prev;
private DoubleNode next;
@basavesh
basavesh / DoublyLinkedList.java
Created November 9, 2012 08:35
DoublyLinkedList.java
package edu.cmu.cs771.hw1;
/**
* This class implements a doubly linked list of characters in Java.
* The instance variables head and tail are initially null.
* As elements are added head points to the first element on the list and tail points to the last element. Each node on the list is of type DoubleNode.
* Each DoubleNode holds a pointer to the previous node and a pointer to the next node in the list.
* @author songluo
*
*/
@basavesh
basavesh / EmptyListException.java
Created November 9, 2012 08:36
EmptyListException.java
package edu.cmu.cs771.hw1;
/**
* Class EmptyListException definition.
* @author songluo
*
*/
public class EmptyListException extends RuntimeException{
/**
@basavesh
basavesh / MerkleHellman.java
Created November 9, 2012 08:36
MerkleHellman.java
package edu.cmu.cs771.hw1;
import java.nio.charset.Charset;
import java.util.*;
import java.math.BigInteger;
/**
* @author songluo
*
*/
@basavesh
basavesh / MerkleHellmanKnapsackTest.java
Created November 9, 2012 08:39
MerkleHellmanKnapsackTest.java
package edu.cmu.cs771.hw1;
import java.nio.charset.Charset;
import java.util.*;
import java.math.BigInteger;
public class MerkleHellmanKnapsackTest {
public MerkleHellmanKnapsackTest() {
// TODO Auto-generated constructor stub
@basavesh
basavesh / prime.py
Created November 17, 2012 17:17
prime no generator
## {{{ http://code.activestate.com/recipes/366178/ (r5)
def primes(n):
if n==2: return [2]
elif n<2: return []
s=range(3,n+1,2)
mroot = n ** 0.5
half=(n+1)/2-1
i=0
m=3
while m <= mroot:
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
int main(int argc, char *argv[])
{
int i =0;
char *memPtr=NULL;
char *memPtr2G=NULL;
int j=0;
#include <stdio.h>
#include <string.h>
#include <netinet/in.h>
#include <event2/event.h>
#include <sys/socket.h>
#include <stdlib.h>
int main(int argc, char **argv)
{
int i;
==7307== Memcheck, a memory error detector
==7307== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al.
==7307== Using Valgrind-3.10.1 and LibVEX; rerun with -h for copyright info
==7307== Command: ./a.out
==7307==
Starting Libevent 2.0.20-stable.
Available methods are:
epoll
poll
select