Skip to content

Instantly share code, notes, and snippets.

View jackolney's full-sized avatar

Jack Olney jackolney

View GitHub Profile
#include <iostream>
#include "juan.h"
using namespace std;
myClass * theClass;
int main() {
// define the size of the array we want.
int theSize = 10;
@jackolney
jackolney / juan.cpp
Last active October 30, 2019 21:16
a class array example in c++
#include "juan.h"
//define the constructor
myClass::myClass(int theSize) :
arraySize(theSize)
{}
//define constructor
myClass::~myClass()
{}
@jackolney
jackolney / convert.sh
Created October 27, 2016 11:17
Animated punchcard of repo over time
convert 01.png -gravity North -pointsize 20 -annotate +0+5 '05/01/16' 01-label.png
convert 02.png -gravity North -pointsize 20 -annotate +0+5 '15/01/16' 02-label.png
convert 03.png -gravity North -pointsize 20 -annotate +0+5 '01/02/16' 03-label.png
convert 04.png -gravity North -pointsize 20 -annotate +0+5 '15/02/16' 04-label.png
convert 05.png -gravity North -pointsize 20 -annotate +0+5 '01/03/16' 05-label.png
convert 06.png -gravity North -pointsize 20 -annotate +0+5 '15/03/16' 06-label.png
convert 07.png -gravity North -pointsize 20 -annotate +0+5 '01/04/16' 07-label.png
@jackolney
jackolney / datr.R
Last active August 30, 2016 19:39
Tool for converting filenames including dates into exifdata
## edit-date-from-filename Rscript
#!/usr/bin/env Rscript
fileName = commandArgs(trailingOnly = TRUE)
# Check is image file
CheckIsImage <- function(file) {
acceptedExts <- c("jpg", "JPEG")
if (tools::file_ext(file) %in% acceptedExts) {
message("File processing...")
} else {
@jackolney
jackolney / inc-test.R
Last active May 4, 2023 01:20
Increment Variables in R
## Increment Function Test
# R doesn't have an `increment operator` like `++` in C++
# However, we can implement one; but, is it faster than just writing out x <- x + 1?
inc <- function(x) {eval.parent(substitute(x <- x + 1))}
# Test One (function)
TestOne <- function() {
x = 1
@jackolney
jackolney / random.cpp
Created March 22, 2016 14:28
Uniform Random Number Generator
//
// main.cpp
// Random
//
// Created by Jack Olney on 22/03/2016.
// Copyright © 2016 Jack Olney. All rights reserved.
//
#include <iostream>
#include <random>
@jackolney
jackolney / test.cpp
Created January 21, 2016 21:27
Passing a pointer to an SEXP vector of vectors to a function
#include <iomanip>
#include <iostream>
#include <vector>
#include "euler.h"
#include "parameters.h"
#include "initial.h"
// R-stuff
#include <Rdefines.h>
#include <stdio.h>
@jackolney
jackolney / size.cpp
Last active August 29, 2015 14:26
vector.size()
#include <iostream>
#include <typeinfo>
#include <vector>
using namespace std;
struct OutOfRange{};
int ConvertInt(const unsigned long int TheUnsignedLong) {
const int DesiredOutput = static_cast<int>(TheUnsignedLong);
@jackolney
jackolney / RealisticUtt.cpp
Last active August 29, 2015 14:15
RealisticUtt
if(theRng->Sample(0.8)) // 80% agree to start ART
if(theRng->Sample(0.8)) // 80% are linked to ART
new ArtInitiation(thePerson,GetTime()); // Initiate ART immediately
else
thePerson->SetInCareState(false,GetTime()); // Person lost from care
else
SchedulePreArtCd4Test(thePerson); // Schedule CD4 test