Skip to content

Instantly share code, notes, and snippets.

View Mattamorphic's full-sized avatar
:shipit:
Building things, and making stuff

Matt B Mattamorphic

:shipit:
Building things, and making stuff
View GitHub Profile
@Mattamorphic
Mattamorphic / (installing a package) pom.xml
Last active December 5, 2019 21:20
Example Maven Configuration : Installing a package
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.mattamorphic.maven.gpr</groupId>
<artifactId>maven-install-test</artifactId>
<version>1.0.0</version>
@Mattamorphic
Mattamorphic / docker-example.yml
Created October 14, 2019 10:43
Docker with GitHub Actions
name: Publish Docker image
on:
push:
branches:
- master
paths:
- 'docker-example/*'
- '.github/workflows/docker-example.yml'
@Mattamorphic
Mattamorphic / InsertionSortAction.java
Created November 1, 2019 19:23
Parallel MergeSort using Java
package com.mattamorphic.concurrent.assignment2;
import java.util.concurrent.RecursiveAction;
import java.util.ArrayList;
public class InsertionSortAction extends RecursiveAction {
private ArrayList<Integer> list;
InsertionSortAction(ArrayList<Integer> list) {
this.list = list;
@Mattamorphic
Mattamorphic / Vagrantfile
Created February 4, 2020 19:16
Open-mpi Vagrant 3-Node cluster
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
# choose how many machines the cluster will contain
N_VMS = 3
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
@Mattamorphic
Mattamorphic / Makefile
Last active February 13, 2020 11:46
Reusable makefile to use with Vagrant Open-MPI cluster
##
# Reusable Makefile
#
# usage: `make [PROCESS] TARGET=[FILENAME_NO_EXT] NODES=node1,node2,node3`
# example: `make all TARGET=hello-world NODES=node1,node2,node3`
COMPILER=mpic++
COMPILER_FLAGS=-g -std=c++0x -O0
OBJECTS=$(TARGET).o
HOSTS=--host $(NODES)
PROCESS_COUNT = -np $(shell echo $(NODES), | grep -o "," | wc -l)
@Mattamorphic
Mattamorphic / hello-world.cpp
Created February 13, 2020 11:33
Open MPI Hello-World
#include <mpi.h>
#include <stdio.h>
int main(int argc, char** argv) {
// Initialize the MPI environment
MPI_Init(NULL, NULL);
// Get the number of processes
int world_size;
MPI_Comm_size(MPI_COMM_WORLD, &world_size);
@Mattamorphic
Mattamorphic / README.md
Created February 14, 2020 08:54
Useful git commands

Sign commits on the current branch since the SHA (inclusive)

git rebase --exec 'git commit --amend --no-edit -n -S' -i SHA^
@Mattamorphic
Mattamorphic / test.rb
Last active April 28, 2020 09:40
Non-Dry-Example
# frozen_string_literal: true
require "minitest/mock"
class MyJobTest < ActiveJob::TestCase
test "check job calls method" do
mock = Minitest::Mock.new
mock.expect :mymethod, nil do |id:, message:|
id.is_a?(Integer) &&
message.is_a?(String)
@Mattamorphic
Mattamorphic / test.rb
Last active April 28, 2020 10:06
Dry-Example
# frozen_string_literal: true
require "minitest/mock"
class MyJobTest < ActiveJob::TestCase
# Helper function to wrap mocking the :mymethod method
#
# expectations - Array of Procs/Lambdas that will be checked against the message
# argument that is passed to the :mymethod method in the MyModule::myclass
# object, all must return true.
@Mattamorphic
Mattamorphic / AndroidManifest.xml
Created October 24, 2020 12:36
Example 034 (for API > 24)
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.example034">
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"