Skip to content

Instantly share code, notes, and snippets.

View akshaynanavati's full-sized avatar

Akshay Nanavati akshaynanavati

View GitHub Profile
@akshaynanavati
akshaynanavati / benchmark.py
Created September 1, 2016 22:48
VersionAlchemy benchmark code
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
@akshaynanavati
akshaynanavati / node.py
Created February 19, 2018 00:17
Node implementation in Python
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
#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');
#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)) {