Skip to content

Instantly share code, notes, and snippets.

Marco Massenzio massenz

Block or report user

Report or block massenz

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@massenz
massenz / font.py
Last active Sep 10, 2019
How to load fonts via Python PIL.
View font.py
# How to load fonts via Python PIL.
# See Stack OF question: https://stackoverflow.com/questions/24085996/how-i-can-load-a-font-file-with-pil-imagefont-truetype-without-specifying-the-ab/41887497#41887497
from PIL import Image, ImageDraw, ImageFont
# sample text and font
unicode_text = u"Arial Font, size 28px"
font = ImageFont.truetype("/Library/Fonts/Arial.ttf", 28, encoding="unic")
# get the line size
@massenz
massenz / minikube-install.sh
Created Sep 29, 2018
Kubernetes Minikube install on MacOS
View minikube-install.sh
#!/bin/bash
#
# Installs minikube on MacOS
# See: https://github.com/kubernetes/minikube/releases
declare -r VERSION=${1:-}
if [[ -z ${VERSION} ]]; then
echo "Please specify a version"
exit 1
@massenz
massenz / hiddenToggle
Created Sep 27, 2018
MacOS Finder - toggle Hidden Files in Finder
View hiddenToggle
#!/bin/bash
ENABLE=${1:-TRUE}
defaults write com.apple.finder AppleShowAllFiles ${ENABLE}
killall Finder
@massenz
massenz / install_jdk_10.sh
Last active Dec 12, 2019
Install OpenJDK 10 on MacOS
View install_jdk_10.sh
#!/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 Aug 10, 2017
List all Docker images in a Shell-friendly format (optionally, JSON too)
View grep-images.py
#!/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 Jun 14, 2016
Platformio fail to printf() floats
View main.cpp
// 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 Feb 13, 2019
libprocess simple HTTP server
View simpleprocess.cpp
/*
* simpleprocess.cpp
*
* Created on: Jun 26, 2015
* Author: Marco Massenzio
*/
#include <iostream>
#include <process/dispatch.hpp>
@massenz
massenz / gtest-install.rst
Last active Oct 29, 2019
Describes how to install and run GTest, a Google framework to conduct unit testing in C++
View gtest-install.rst

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 Aug 8, 2017
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
View README.rst

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 Feb 16, 2015
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.
View README.rst

HOW-TO Build SparkLab

Author:
  1. Massenzio
Date: 2015-01-22
Version: 1.0.0
Scope:Personal Use
License:Apache 2
You can’t perform that action at this time.