Skip to content

Instantly share code, notes, and snippets.

#include <mpi.h>
#include <stdio.h>
#include <stdlib.h>
#define ROOT 0
int main (int argc, char** argv) {
int i, j, rank, size;
MPI_Datatype diagonal;
#include <mpi.h>
#include <stdio.h>
#define ROOT 0
#define REORDER 0
int main (int argc, char** argv) {
int i, j, local_rank, rank, size;
int rank_src, rank_dest, north, east, south, west;
#include <mpi.h>
#include <stdio.h>
int main (int argc, char** argv) {
int rank, size;
MPI_Init(&argc, &argv);
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
MPI_Comm_size(MPI_COMM_WORLD, &size);
#include <mpi.h>
#include <stdio.h>
#define SIZE 10000
int main (int argc, char** argv) {
int i, rank;
int A[SIZE], B[SIZE];
MPI_Status s1, s2;
#include <mpi.h>
#include <stdio.h>
#define SIZE 10000
int main (int argc, char** argv) {
int i, rank, size, left, right;
int A[SIZE], B[SIZE];
MPI_Request request;
#include <mpi.h>
#include <stdio.h>
int main (int argc, char** argv) {
int i, rank, size, left, right;
double A, B, SUM;
MPI_Status status;
MPI_Init(&argc, &argv);
@jacquerie
jacquerie / Elasticsearch percolate API
Created November 26, 2013 16:35
When run gives: {"ok":true,"_index":"_percolator","_type":"foo","_id":"barbaz1","_version":1} {"ok":true,"_index":"_percolator","_type":"foo","_id":"barbaz2","_version":1} {"ok":true,"matches":[]} Expecting: {"ok":true,"_index":"_percolator","_type":"foo","_id":"barbaz1","_version":1} {"ok":true,"_index":"_percolator","_type":"foo","_id":"barbaz…
#!/bin/bash
# Deletes, then creates the collection "foo".
curl -s -XDELETE localhost:9200/foo > /dev/null
curl -s -XPUT localhost:9200/foo > /dev/null
# Creates two percolators called "barbaz1" and "barbaz2" with different
# values in the "plugh" field.
curl -XPUT localhost:9200/_percolator/foo/barbaz1 -d '{
"plugh": "xyzzy",
@jacquerie
jacquerie / addKonamiCode.js
Last active July 19, 2017 18:49
Adds a Konami Code easter egg to a page. Requires jQuery.
var addkonamiCode = function () {
var status = 0;
$("body").keydown(function (e) {
if ((e.which === 38 && (status === 0 || status === 1))
|| (e.which === 40 && (status === 2 || status === 3))
|| (e.which === 37 && (status === 4 || status === 6))
|| (e.which === 39 && (status === 5 || status === 7))
|| (e.which === 66 && status === 8)) {
status++;
@jacquerie
jacquerie / iubenda.js.coffee
Last active August 29, 2015 14:00
Turbolinks.js + iubenda.js
class @Iubenda
@load: ->
if typeof Turbolinks isnt "undefined" and Turbolinks.supported
document.addEventListener "page:change", (->
Iubenda.loadTag()
), true
else
Iubenda.loadTag()
@jacquerie
jacquerie / evolution.py
Last active August 29, 2015 14:03
What would past presidential elections look like if electoral votes were multiplied by percentage of people believing in evolution? Usage: python evolution.py votes-20**.tsv
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
import sys
EVOLUTION_DATA = {
"Alabama": 0.51, "Alaska": 0.66, "Arizona": 0.65, "Arkansas": 0.53,
"California": 0.73, "Colorado": 0.69, "Connecticut": 0.77, "Delaware": 0.70,
"Florida": 0.64, "Georgia": 0.60, "Hawaii": 0.71, "Idaho": 0.59, "Illinois": 0.68,
"Indiana": 0.60, "Iowa": 0.62, "Kansas": 0.61, "Kentucky": 0.57, "Louisiana": 0.62,