Skip to content

Instantly share code, notes, and snippets.

Akshay Nanavati akshaynanavati

Block or report user

Report or block akshaynanavati

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View l1_size.cpp
#include <chrono>
#include <cstdlib>
#include <iostream>
constexpr auto MAX = 1 << 24;
char accessMemory(char *buf, size_t n) { return buf[0] ^ buf[n - 1]; }
char *align(char *buf, size_t &size, size_t alignment) {
while ((uint64_t)buf & (alignment - 1)) {
View sort.cpp
#include <algorithm>
#include <chrono>
#include <ctime>
#include <iostream>
#include <random>
#include <vector>
std::string randString() {
std::mt19937 rng(time(NULL));
std::string s(64, '\0');
@akshaynanavati
akshaynanavati / node.py
Created Feb 19, 2018
Node implementation in Python
View node.py
class Node(object):
def __init__(self, data, next=None):
self.data = data
self.next = next
def __str__(head):
s = ''
while head:
s += '{} -> '.format(head.data)
head = head.next
@akshaynanavati
akshaynanavati / benchmark.py
Created Sep 1, 2016
VersionAlchemy benchmark code
View benchmark.py
from contextlib import contextmanager
import sys
import time
import sqlalchemy as sa
from sqlalchemy import create_engine
from sqlalchemy.exc import InternalError
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker
from sqlalchemy.schema import UniqueConstraint
You can’t perform that action at this time.