Skip to content

Instantly share code, notes, and snippets.

View krismp's full-sized avatar
🏠
Working from home

Kris Mulyandani P. krismp

🏠
Working from home
View GitHub Profile
@krismp
krismp / quicksort.c
Created March 13, 2019 05:44
Non randomized quicksort
View quicksort.c
/* C implementation QuickSort */
#include<stdio.h>
// A utility function to swap two elements
void swap(int* a, int* b)
{
int t = *a;
*a = *b;
*b = t;
}
@krismp
krismp / randomize_quicksort.cpp
Created March 13, 2019 05:42
Randomize Quicksort Algorithm
View randomize_quicksort.cpp
/* C++ implementation QuickSort using Lomuto's partition
Scheme.*/
#include <cstdlib>
#include <iostream>
using namespace std;
/* This function takes last element as pivot, places
the pivot element at its correct position in sorted
array, and places all smaller (smaller than pivot)
to left of pivot and all greater elements to right
@krismp
krismp / gather-to-all.c
Created March 12, 2019 04:25
Gather to all
View gather-to-all.c
#include <mpi.h>
#include <stdio.h>
#include <stdlib.h>
int numnodes;
int main(int argc, char* argv[])
{
int rank;
int *back_array;
int i,data;
View collective_scatter_and_gather.c
#include <mpi.h>
#include <stdio.h>
#include <stdlib.h>
int numnodes;
int main(int argc, char* argv[])
{
int rank;
int *myray,*send_array,*back_array;
int count;
@krismp
krismp / introrx.md
Created January 11, 2017 07:33 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing
View introrx.md
@krismp
krismp / gulpfile.js
Created September 10, 2016 00:24 — forked from danharper/gulpfile.js
New ES6 project with Babel, Browserify & Gulp
View gulpfile.js
var gulp = require('gulp');
var sourcemaps = require('gulp-sourcemaps');
var source = require('vinyl-source-stream');
var buffer = require('vinyl-buffer');
var browserify = require('browserify');
var watchify = require('watchify');
var babel = require('babelify');
function compile(watch) {
var bundler = watchify(browserify('./src/index.js', { debug: true }).transform(babel));
@krismp
krismp / Install Composer using MAMP's PHP.md
Created August 27, 2016 01:27 — forked from irazasyed/Install Composer using MAMP's PHP.md
Instructions on how to change preinstalled Mac OS X PHP to MAMP's PHP Installation and then install Composer Package Management
View Install Composer using MAMP's PHP.md
@krismp
krismp / gist:43fa6b50448b54b06cf1
Created September 17, 2015 01:16
install pg gem on Mac OSX
View gist:43fa6b50448b54b06cf1
```
gem install pg -- --with-pg-config=/Applications/Postgres.app/Contents/MacOS/bin/pg_config
Note: in newer versions (in 9.4 at least) the path is actually: /Applications/Postgres.app/Contents/Versions/9.4/bin/pg_config
```
View gist:57edef1cd11a0642dbb7
look process:
`lsof -i :<PORT NUMBER>
kill process
`kill -9 <PID>`
View multiple_ssh_setting.md