Skip to content

Instantly share code, notes, and snippets.

View rehrumesh's full-sized avatar
:octocat:
🚀

Rumesh Eranga Hapuarachchi rehrumesh

:octocat:
🚀
View GitHub Profile
@rehrumesh
rehrumesh / hello.c
Created May 31, 2015 13:06
Hello world in MPI.
#include <stdio.h>
#include <mpi.h>
int main(int argc, char *argv[])
{
int rank, size;
MPI_Init(&argc, &argv);
@rehrumesh
rehrumesh / helloHost.c
Created May 31, 2015 13:08
Hello world with hostname
#include <stdio.h>
#include "mpi.h"
int main(int argc, char **argv)
{
int me, nprocs, namelen;
char processor_name[MPI_MAX_PROCESSOR_NAME];
MPI_Init(&argc, &argv);
MPI_Comm_size(MPI_COMM_WORLD, &nprocs);
@rehrumesh
rehrumesh / mpiMult.c
Created May 31, 2015 13:37
Matrix multiplication using MPI
/**********************************************************************
* MPI-based matrix multiplication AxB=C
*********************************************************************/
#include <stdio.h>
#include "mpi.h"
#define N 4 /* number of rows and columns in matrix */
MPI_Status status;
@rehrumesh
rehrumesh / mm.c
Created May 31, 2015 13:41
Matrix multiplication sequential code
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <sys/time.h>
#include <assert.h>
#define RANDLIMIT 5 /* Magnitude limit of generated randno.*/
#define N 4 /* Matrix Size */
#define NUMLIMIT 70.0
@rehrumesh
rehrumesh / sketch.ino
Created June 19, 2015 07:27
Remote output XBee
int ledPin = 13;
int buttonPin = 2;
boolean flag = LOW;
boolean buttonState;
boolean lastButtonState = LOW;
int lastDebounceTime = 0;
int debounceDelay = 50;
void setup() {
@rehrumesh
rehrumesh / malloc.c
Created November 5, 2015 08:29
Simple malloc implementation using nodes
#include <stdio.h>
/**
* stucture to hold the details about the spaces
*/
typedef struct node{
int size; // Original requested size
char isFree; // 1 if free or 0 if in use
struct node *next; // pointer to to next memory chunk
} node;
Brackets Additional Right Click Menu
Brackets Devicons
Brackets File Format
Brackets SASS
Brackets SASS Code Hints
Color Highlighter
Duplicate Files & Folders
Pop-up Menu Brackets
Projects
Quick Search
(function (module) {
'use strict';
module.directive('ngEnter', function () {
return function (scope, element, attrs) {
element.bind("keydown keypress", function (event) {
if(event.which === 13) {
scope.$apply(function (){
scope.$eval(attrs.ngEnter);
});
window.onbeforeunload = function(e) {
if (window.location.href.includes("sometext")) {
e = e || window.event;
// For IE and Firefox prior to version 4
if (e) {
e.returnValue = 'Sure?';
}
// For Safari
@rehrumesh
rehrumesh / test
Created June 24, 2017 07:55
Extend CentOs LVM Partition
fdisk -l
df -h
fdisk /dev/sda
n
p
enter
enter
enter
t