Skip to content

Instantly share code, notes, and snippets.

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

Marco Massenzio massenz

🏠
Working from home
View GitHub Profile
@massenz
massenz / install_jdk_10.sh
Last active December 12, 2019 11:18
Install OpenJDK 10 on MacOS
#!/bin/bash
#
# Installs the OpenJDK 10 from java.net.
VERSION=10.0.2
DOWNLOAD_URL="download.java.net/java/GA/jdk10"
JDK="openjdk-${VERSION}_osx-x64_bin.tar.gz"
INSTALL_DIR="/Library/Java/JavaVirtualMachines"
wget https://${DOWNLOAD_URL}/${VERSION}/19aef61b38124481863b1413dce1855f/13/${JDK} -O /tmp/${JDK}
@massenz
massenz / grep-images.py
Created August 10, 2017 18:04
List all Docker images in a Shell-friendly format (optionally, JSON too)
#!/usr/bin/env python
#
# Created by M. Massenzio (c) 2017.
# The output of `docker images` is easy on the eye, but not
# terribly helpful if you want to pipe it into further shell
# commands; and using `cut` only gets you so far (in fact,
# not very far at all).
#
# This script emits the list of Docker images on your system
@massenz
massenz / main.cpp
Created June 14, 2016 05:43
Platformio fail to printf() floats
// AlertAvert.com (c) 2016. All rights reserved
//
// The code below has been adapted from tutorials on
// mbed.org - credits should go to ARM Ltd.
//
// Author: M. Massenzio
#include "mbed.h"
// USB out to the host PC - from a terminal window access
@massenz
massenz / simpleprocess.cpp
Last active February 13, 2019 14:22
libprocess simple HTTP server
/*
* simpleprocess.cpp
*
* Created on: Jun 26, 2015
* Author: Marco Massenzio
*/
#include <iostream>
#include <process/dispatch.hpp>
@massenz
massenz / gtest-install.rst
Last active December 19, 2022 09:14
Describes how to install and run GTest, a Google framework to conduct unit testing in C++

Build and install Google Test

Download the latest (1.7.0) from Google Code (Q: where is it going to live, once GCode shuts down?)

Then follow the primer, but more to the point, the README (YMMV) Having installed CLion and cmake, this is how I built gtest:

brew install cmake
cd gtest-1.7.0
@massenz
massenz / README.rst
Last active August 8, 2017 22:18
Apache Mesos build and install scripts; optionally runs the Master/Slave locally and executes a demo (C++) framework against it, to validate it all went according to plan

Apache Mesos Build scripts

The Getting started instructions are a good start (no surprise there!) but are somewhat incomplete and currently look a bit outdated (I plan to fix them soon): however, the outcome has been that I have struggled more than I felt necessary in building and running Mesos on a dev VM (Ubuntu 14.04 running under VirtualBox).

Some of the issue seem to arise from the unfortunate combination of Mesos Master trying to guess its own IP address, the VM being (obviously) non-DNS resolvable and, eventually, the Slave and the Framework failing to properly communicate with the Master.

In the process of solving this, I ended up automating all the dependencies installation, building and running the framework; I have then broken it down into the following modules to make it easier to run only parts of the process.

@massenz
massenz / README.rst
Created February 16, 2015 07:30
This will install all binaries and libraries for the SciPy Python environment, Cassandra and Spark on an AWS Ubuntu AMI instance. This assumes you are running this script as described in the README documentation.

HOW-TO Build SparkLab

Author
  1. Massenzio
Date

2015-01-22

Version

1.0.0

Scope

Personal Use

License

Apache 2

@massenz
massenz / auth_server.py
Last active December 24, 2017 15:15
Simple Flask server to demonstrate how to use LaunchKey (http://www.launchkey.com) to authenticate users
# Copyright AlertAvert.com (c) 2013. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
@massenz
massenz / alert
Last active April 2, 2017 11:24
Originally written for Mandrill (screw them), this script can send an email alert, for example, when a remote job fails or some other unexpected event happens: I'm using it on my QNAP TS-212 NAS to alert me about backup jobs failures and other abnormal events.
#!/bin/bash
#
# Failure reporter, logs to a well-known log file failure messages
#
# Created 2014-04-30, M. Massenzio (m.massenzio@gmail.com)
declare -r LOGFILE="/var/log/fail.log"
declare -r ALERT_ICON="/usr/share/icons/ubudao-style/actions/dialog-warning.png"
declare -r ERROR_ICON="/usr/share/icons/ubudao-style/actions/stock_dialog-error.png"
#!/bin/env python
__author__ = 'Marco Massenzio <m.massenzio (at) gmail com'
""" Simple python decorator example.
@see: http://codetrips.com/2014/01/27/python-decorators-again
"""
from functools import wraps