Skip to content

Instantly share code, notes, and snippets.

View vjames19's full-sized avatar

Victor J Reventos vjames19

View GitHub Profile
@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 / 1_README.md
Last active August 29, 2015 13:59
golang tour exercise solutions

Golang Tour Exercise solutions

@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 / 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 / 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 / Pair.java
Last active December 14, 2015 10:59
Pairs HackerrankGiven N numbers [N<=10^5], count the total pairs of numbers that have a difference of K. [K>0 and K<1e9]Input Format:1st line contains N & K (integers).2nd line contains N numbers of the set. All the N numbers are assured to be distinct.Output Format:One integer saying the no of pairs of numbers that have a diff K.Sample Input #0…
package search.pairs;
/* Head ends here */
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;
public class Solution {
@vjames19
vjames19 / numberOfOnes.py
Created May 6, 2013 03:53
Number of Ones code eval
import sys
import math
def numberOfOnes(n):
mask = 1
bits = n.bit_length()
if n < 0:
bits +=1
count = 0
for i in range(0, bits):
count += n & mask
@vjames19
vjames19 / EclipseWorkspaceCreatorKeepingPreferences.py
Last active December 17, 2015 03:29
Copies the preferences from the src workspace to the dest workspace. If the dest workspace doesn't exist it will be created. Enjoy!
'''
Created on May 8, 2013
@author: Victor J. Reventos
Copies the preferences from the src workspace to the dest workspace.
If the dest workspace doesn't exist it will be created.
Enjoy!
'''

Drag from an existing node to add a new node or link. Click to select/deselect nodes/links. Hit the DELETE key to remove the selected node or link. Drag to pan. Scroll to zoom.

Built with D3.js.

# Source: https://splice.com/blog/cleaning-git-branches/
git checkout master && git branch --merged | grep -v master | xargs git branch -d