Skip to content

Instantly share code, notes, and snippets.

View lettergram's full-sized avatar
🕶️
Loading...

Austin Walters lettergram

🕶️
Loading...
View GitHub Profile
key_t key;
int id;
char *msg;
int write_mode = 0644;
/**
* Make a key!
* This Key will be used to
* keep track of the datas
* location in memory
int fd;
char * mapped_memory;
/**
* Open a file and map it to memory,
* once it is mapped to memory we can close
* the file because we have access.
*/
fd = open(argv[1], O_RDWR | O_CREAT);
mapped_memory = mmap(NULL, MAX, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
int pfds[2];
int SIZE = 30;
char buf[SIZE];
char * msg = "This is a pipe example!";
/** Generates two pipe file descriptors **/
pipe(pfds);
/** writer **/
if (!fork()) {
/* Creates fifo */
mkfifo(argv[1], S_IRWXU | S_IRWXG | S_IRWXO);
int fifo = open(argv[1], O_RDONLY);
/* Duplicate the file 'fifo', so that file descriptor 0 points to it.
* Note that 0 is the file descriptor of stdin. */
dup2(fifo, 0);
char line[1024];
int i = 0;
package main
import (
"image"
"image/color"
"image/draw"
"image/png"
"code.google.com/p/draw2d/draw2d"
"log"
/**
* Producer-Comsumer example, written in C++ May 4, 2014
* Compiled on OSX 10.9, using:
* g++ -std=c++11 producer_consumer.cpp
**/
#include <iostream>
#include <thread>
#include <mutex>
#include <condition_variable>
/**
* Semaphore example, written in C++ May 4, 2014
* Compiled on OSX 10.9, using:
* g++ -std=c++11 semaphore.cpp
**/
#include <iostream>
#include <thread>
#include <mutex>
#include <condition_variable>
import numpy as np
def func1(x, y):
return x*x + x*y + y*y
def func2(y, x):
return x**3 + y**3 + y*x**2 + y**2 + 2
def monte(func, n, ymin, ymax, xmin, xmax):
/* version 2.4 of openCV */
using namespace cv;
/**
* Takes in a RGB image and outputs
* a Lab space image.
**/
Mat BGR2LAB(Mat const &imgRGB){
Mat imgLab;
cvtColor(imgRGB, imgLab, CV_RGB2Lab);
/**
* Description:
* Finds the gradient between two images, searches the Red channel in RGB
*
* @param: img - image to find gradient on
* @param: prune - the cut off for the pruning (difference between two steps
* @param: step - How many pixels apart to check
* @Return: Mat grad - the image with gradients colored
**/
Mat findGradient(Mat &img, unsigned int prune, unsigned int step){