Skip to content

Instantly share code, notes, and snippets.

Loo Rong Jie rongjiecomputer

Block or report user

Report or block rongjiecomputer

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
rongjiecomputer / prime.cpp
Created Apr 5, 2017
Sieve of Eratosthenes with C++ constexpr
View prime.cpp
#include <stdio.h>
template <size_t N>
struct PrimeTable {
constexpr PrimeTable() : sieve() {
sieve[0] = sieve[1] = false;
for (size_t i = 2; i < N; i++) sieve[i] = true;
for (size_t i = 2; i < N; i++) {
if (sieve[i])
for (size_t j = i*i; j < N; j += i) sieve[j] = false;
rongjiecomputer / ascii-win.c
Created Dec 20, 2016
Ascii Fluid Simulation (Windows)
View ascii-win.c
// this de-obfuscated version by Davide Della Casa
// original obfuscated version by Yusuke Endoh
// modified for Windows (Mingw-w64)
// formatted in Chromium C/C++ style
// compile with gcc ascii-win.c -o ascii -O3 -s -flto
// usage and original repo see
#include <stdio.h>
#include <complex.h>
#include <math.h>
View bsearch.cpp
/* std::lower_bound + hand-written move */
void insert(Index x) {
auto it = std::lower_bound(begin(), end(), x);
if (it == end()) push_back(x);
else if (*it > x) {
Index i = it - begin();
resize(size() + 1);
for (Index j = size() - 1; j > i; j--) {
rongjiecomputer /
Created Jun 4, 2016
Python code to trim raw text of Complete Sherlock Holmes
Original raw text:
Trimmed Format:
- Each line is a complete paragraph.
- Each line is ended with two new line characters ('\n\n') (including the last line).
- Disclaimer at the end of the raw text is not deleted, you need to delete it yourself.
You can’t perform that action at this time.