Skip to content

Instantly share code, notes, and snippets.

View vjames19's full-sized avatar

Victor J Reventos vjames19

View GitHub Profile
@vjames19
vjames19 / ImperativeVsFunctionalEvenNumbers.java
Created November 30, 2017 04:41
Imperative vs functional get even numbers
package com.amazon.pq.listingviolationreview.common;
import com.google.common.collect.ImmutableList;
import java.util.ArrayList;
import java.util.List;
public class Test {
public static List<Integer> evenNumbers(List<Integer> integers) {
@vjames19
vjames19 / FutureOptional.java
Created October 26, 2017 17:11
Java Future Optional Monad
package com.github.vjames19.functional;
import lombok.RequiredArgsConstructor;
import java.util.Optional;
import java.util.concurrent.CompletableFuture;
import java.util.function.Function;
import static java.util.concurrent.CompletableFuture.completedFuture;
# Source: https://splice.com/blog/cleaning-git-branches/
git checkout master && git branch --merged | grep -v master | xargs git branch -d
@vjames19
vjames19 / Dockerfile
Created April 19, 2015 17:56
nginx, nodejs Docker expample
FROM node:0.10-wheezy
# node-canvas dependencies.
RUN apt-get update && apt-get install -y libcairo2-dev libjpeg8-dev libpango1.0-dev libgif-dev build-essential g++
# nginx (fast proxy server)
RUN apt-get update && apt-get install -y nginx
# Install global dependencies
RUN npm install -g pm2
@vjames19
vjames19 / HL.m
Last active August 29, 2015 14:18
Quiz 2 INEL 4301
function y = HL(x)
x2 = x(x >= -60 & x <= 60);
y(find(x >= -60 & x <= 60))= exp(-1i *((2*pi)/30 * x2));
y(find(x > 60 | x < -60)) = 0;
end
@vjames19
vjames19 / LargestBlockOfOnes.java
Last active August 29, 2015 14:17
Largest block of ones divide and conquer
package com.vjames19;
/**
* Created by vjames19 on 3/16/15.
*/
public class LargestBlockOfOnes {
public static int[] largestBlockOfOnes(int[] a, int low, int sup) {
if (low > sup) {
return new int[] {-1, -1};
@vjames19
vjames19 / CMakeLists.txt
Last active February 23, 2022 12:46
Image Filtering: Gaussian blur, motion blur.
cmake_minimum_required(VERSION 2.8)
project( imageproc )
find_package(OpenMP REQUIRED)
if(OPENMP_FOUND)
message(STATUS "Enabling OpenMP support")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_EXE_LINKER_FLAGS}")
else()
@vjames19
vjames19 / 1_README.md
Last active August 29, 2015 13:59
golang tour exercise solutions

Golang Tour Exercise solutions

@vjames19
vjames19 / ox_sensor_launchpad.c
Last active August 29, 2015 13:58
UART communication with oxygen sensor with msp430 launchpad
#include <stdlib.h>
#include <string.h>
#include "msp430.h"
#define TXD BIT2
#define RXD BIT1
unsigned int CV = 0;
unsigned int DV = 0;
unsigned int RO = 0;
@vjames19
vjames19 / ox_sensor.c
Last active April 16, 2016 12:54
Get oxygen sensor data through UART for the msp430fr5739
#include <stdlib.h>
#include <string.h>
#include "msp430.h"
unsigned int CV = 0;
unsigned int DV = 0;
char RO = '0';
const double CRITICAL_OXYGEN_LEVEL = 1.5;
volatile double oxygenThreshold = 2;
volatile double oxygen = 15; // assign a value greater than 2