Towards optimal Ramsey graphs and randomness extractors