Skip to content

Instantly share code, notes, and snippets.

View basavesh's full-sized avatar
👨‍💻

Basavesh Ammanaghatta Shivakumar basavesh

👨‍💻
View GitHub Profile
@basavesh
basavesh / x86-assembly-notes.md
Created April 22, 2024 21:15 — forked from mikesmullin/x86-assembly-notes.md
Notes on x86-64 Assembly and Machine Code

Mike's x86-64 Assembly (ASM) Notes

Assembling Binary Machine Code

Operating Modes:

These determine the assumed/default size of instruction operands, and restricts which opcodes are available, and how they are used.

Modern operating systems, booted inside Real mode,

@basavesh
basavesh / memory_layout.md
Created January 13, 2018 23:39 — forked from CMCDragonkai/memory_layout.md
Linux: Understanding the Memory Layout of Linux Executables

Understanding the Memory Layout of Linux Executables

Required tools for playing around with memory:

  • hexdump
  • objdump
  • readelf
  • xxd
  • gcore
==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
#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;
#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;
@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:
@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 / 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 / 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 / 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
*
*/