This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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)) { |