Skip to content

Instantly share code, notes, and snippets.

View sdasgup3's full-sized avatar
🏊‍♂️
in mid-ocean

Sandeep Dasgupta sdasgup3

🏊‍♂️
in mid-ocean
View GitHub Profile
void ensureAligned(int Alignment, HeapData* GlobalData) {
assert(isPowerOf2_32(Alignment) && Alignment > 0);
while (GlobalData->size() & (Alignment-1)) GlobalData->push_back(0);
}
@sdasgup3
sdasgup3 / bstiterator.cpp
Last active October 13, 2016 09:40
Custom BST iterator
#include<iostream>
#include<vector>
#include<stack>
using namespace std;
template <class T>
class bstnode {
public:
In .ssh/config
Host github.com
2 IdentityFile ~/.ssh/id_rsa
@sdasgup3
sdasgup3 / libzipplayground.cpp
Created September 28, 2016 17:57
How to use libzip
// Compile:
// g++ libzipplayground.cpp -I<path to libzip include> libarchive-rw.a -lz
#include<iostream>
#include<string>
#include <zip.h>
#include <cstdlib>
using namespace std;
char *readfile(string filename, size_t *size) {
char * buffer;
- Folloing is the change in supported count from the previous runs on llvm testsuite
| Suite | Total | Prev | Unsupp | Supp | Seg | Diff | Pass | Curr | Unsupp | Supp | Seg | Diff | Pass |
|:----------:|:-----:|------|--------|------|-----|------|------|------|--------|------|-----|------|------|
| UnitTests | 110 | | 22 | 88 | 2 | 14 | 72 | | 5 | 105 | 2 | 24 | 79 |
| Regression | 65 | | 17 | 48 | 1 | 7 | 40 | | 13 | 52 | 2 | 8 | 42 |
| Benchmark | 138 | | 92 | 46 | 6 | 13 | 27 | | 40 | 98 | 37 | 24 | 37 |
| Multisource| 185 | | 156 | 29 | NA | NA | NA | | 63 | 122 | 38 | 29 | 55 |
@sdasgup3
sdasgup3 / agenda.md
Last active December 9, 2016 19:10
Meeting Agenda
  • Our Goal
  • Functional and Rich IR
  • Stack deconstruction and where we are going with that.
  • Ran Mcsema new reg assign on llvm tetssuite (Before(vector instrcution support) and After)
Suite Total Before Unsupp Supp Seg Diff Pass Curr Unsupp Supp Seg Diff Pass
UnitTests 110 22 88 2 14 72 5 105 2 24 79
Regression 65 17 48 1 7 40 13 52 2 8 42
Benchmark 138 92 46 6 13 27 40 98 37 24 37
@sdasgup3
sdasgup3 / recover_stack_vars.py
Created March 30, 2017 06:27
recover stack resident "scalar variables" and "structures"
import idaapi
import idc
import idautils
def _get_flags_from_bits(flag):
if -1 == flag:
return ""
cls = {
'MASK':1536,
@sdasgup3
sdasgup3 / fileparse.pl
Created May 12, 2017 08:24
Split filepath into (parent directory, basename, extension)
# Assumpsion: no '.' in the filepath
sub split_filename {
my $arg = shift @_;
if("" eq $arg) {
return ("", "", "");
}
my ($dir, $basename,$ext) = ("", "", "");
my @components = split (/\//, ${arg});
@sdasgup3
sdasgup3 / c++timer.cpp
Created September 10, 2017 01:24
Comparison of various c++ timers
/* clock example: frequency of primes */
#include <chrono>
#include <cstdint>
#include <math.h> /* sqrt */
#include <stdio.h> /* printf */
#include <sys/time.h>
#include <time.h> /* clock_t, clock, CLOCKS_PER_SEC */
using namespace std::chrono;
@sdasgup3
sdasgup3 / infonum.py
Created November 2, 2017 03:14
Decimal-Hexadecimal-2's complement Binary Calculator
#!/usr/bin/python
##############################################################################################################
# Extract information about a number. #
# #
# Example Usage: python infonum.py --bit 4 0xf #
# Output: #
# Base 10: -1 #
# Base 16: f #
# 2's Compliment binary: 1111 #