Skip to content

Instantly share code, notes, and snippets.

Aaron Ang aaronang

Block or report user

Report or block aaronang

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
@aaronang
aaronang / main.cpp
Last active Feb 21, 2019
Interview Question: Review the handwritten sorting library in C++.
View main.cpp
#include <cstdlib>
#include <iostream>
#include <sorter.hpp>
int main (int argc, char *argv[]) {
int* a = new int[10];
for (int i = 0; i < 10; i++) {
a[i] = rand();
}
View average.cpp
bool double_eq(const double a, const double b) {
return std::fabs(a - b) < std::numeric_limits<double>::epsilon();
}
double average(const vector<int> &numbers) {
int sum = std::accumulate(numbers.begin(), numbers.end(), 0);
return sum / numbers.size();
}
int main() {
@aaronang
aaronang / quadtree.jl
Created Oct 19, 2018
Just experimenting with RegionTrees
View quadtree.jl
module Playground
using RegionTrees
import StaticArrays: SVector
const Point = SVector{2, Float32}
root = Cell(SVector(0., 0), SVector(1., 1), [
Point(0, 0),
Point(.5, .5),
@aaronang
aaronang / CMakeLists.txt
Last active Aug 24, 2018
Calling a Python script from C++ 🐍
View CMakeLists.txt
cmake_minimum_required(VERSION 3.12)
project(popen)
set(CMAKE_CXX_STANDARD 11)
add_executable(popen main.cpp)
install(FILES hello.py
DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
@aaronang
aaronang / .bashrc
Created Jul 16, 2018
Bash prompt for servers
View .bashrc
#
# Clean and minimalistic Bash prompt
# Author: Artem Sapegin, sapegin.me
#
# Inspired by: https://github.com/sindresorhus/pure & https://github.com/dreadatour/dotfiles/blob/master/.bash_profile
#
# Notes:
# - $local_username - username you don’t want to see in the prompt - can be defined in ~/.bashlocal : `local_username="admin"`
# - Colors ($RED, $GREEN) - defined in ../tilde/bash_profile.bash
#
View lerna-debug.log
lerna(verbose) GitUtilities.isInitialized ()
lerna(verbose) GitUtilities.isInitialized () => true
lerna(verbose) GitUtilities.getTopLevelDirectory()
lerna(verbose) GitUtilities.getTopLevelDirectory() => "."
lerna(verbose) FileSystemUtilities.existsSync("./lerna.json")
lerna(verbose) FileSystemUtilities.existsSync("./lerna.json") => true
lerna(verbose) FileSystemUtilities.readFileSync("./lerna.json")
lerna(verbose) FileSystemUtilities.readFileSync("./lerna.json") => "{\n \"lerna\": \"2.0.0-beta.38\",\n \"version\": \"6.23.1\",\n \"changelog\": {\n \"repo\": \"babel/babel\",\n \"labels\": {\n \"tag: spec compliancy\": \":eyeglasses: Spec Compliancy\",\n \"tag: breaking change\": \":boom: Breaking Change\",\n \"tag: new feature\": \":rocket: New Feature\",\n \"tag: bug fix\": \":bug: Bug Fix\",\n \"tag: polish\": \":nail_care: Polish\",\n \"tag: documentation\": \":memo: Documentation\",\n \"tag: internal\": \":house: Internal\"\n }\n },\n \"cacheDir\": \".c
View babel-cli\src\babel\util.js
export function transform(filename, code, opts) {
opts = defaults(opts || {}, index.opts);
opts.filename = filename;
const result = babel.transform(code, opts);
result.filename = filename;
result.actual = code;
return result;
}
View babel-cli\src\babel\index.js
const fn = commander.outDir ? dirCommand : fileCommand;
fn(commander, filenames, opts);
You can’t perform that action at this time.