Skip to content

Instantly share code, notes, and snippets.

View dereckmezquita's full-sized avatar
🇺🇸

Dereck Mezquita dereckmezquita

🇺🇸
View GitHub Profile
@dereckmezquita
dereckmezquita / vscode-settings.json
Last active November 7, 2021 07:16
Settings from VScode.
{
"security.workspace.trust.untrustedFiles": "open",
"editor.wordWrap": "on",
"files.exclude": {
"**/.git": false
},
"explorer.compactFolders": false,
"window.zoomLevel": 0.5,
"files.associations": {
"*.Rmd": "r"
@dereckmezquita
dereckmezquita / gource.sh
Created November 7, 2021 03:21
Some bash code on running the gource utility for visualising GitHub repo contributions.
cd /Users/Dereck/Desktop/digibyte
gource \
-s .06 \
-1280x720 \
--auto-skip-seconds .1 \
--multi-sampling \
--stop-at-end \
--key \
--highlight-users \
--hide mouse,progress \
@dereckmezquita
dereckmezquita / random-sampling-numbers.cpp
Created November 6, 2021 21:49
Code for randomly selecting random numbers between an integer and tallying up results. Reference for generating random numbers. R used for visualisation.
#include <Rcpp.h>
#include <iostream>
#include <random>
#include <chrono>
using namespace Rcpp;
std::mt19937 rng(std::chrono::steady_clock::now().time_since_epoch().count());
// [[Rcpp::export]]
@dereckmezquita
dereckmezquita / pi.cpp
Last active November 13, 2021 23:32
Different methods in C++/Rcpp code for calculating the constant Pi: Gregory Leibniz, Nilakantha, and Monte Carlo. Plotting is done in R.
#include <Rcpp.h>
#include <iostream>
#include <random>
#include <chrono>
#include <math.h>
using namespace Rcpp;
// [[Rcpp::export]]
long double gregoryLeibnizCpp(int iterations) {
long double pi = 1;