Skip to content

Instantly share code, notes, and snippets.

Avatar
👋

Massimiliano Marcon mmarcon

👋
View GitHub Profile
View playbook.yml
---
- hosts: all
sudo: yes
vars:
# list of apps to be managed by pm2
pm2_apps:
- /var/apps/services/app.js
- /var/apps/services/otherapp.js
# franklinkim.nodejs
View playbook.yml
---
- hosts: all
sudo: yes
vars:
# list of apps to be managed by pm2
pm2_apps:
- /var/apps/services/app.js
- /var/apps/services/otherapp.js
# franklinkim.nodejs
View playbook.yml
---
- hosts: all
sudo: yes
vars:
# franklinkim.nodejs
nodejs_version: 0.12
nodejs_packages:
- pm2
roles:
View playbook.yml
---
- hosts: all
sudo: yes
tasks:
- name: install nginx
apt: name=nginx state=present update_cache=yes
notify:
- start nginx
handlers:
- name: start nginx
View Vagrantfile
Vagrant.configure(2) do |config|
config.vm.box = "ubuntu/trusty64"
config.vm.network "forwarded_port", guest: 80, host: 8080
config.vm.provider "virtualbox" do |vb|
# Display the VirtualBox GUI when booting the machine
vb.gui = false
vb.memory = "512"
end
# Use Ansible for provisioning and load playbook.yml
config.vm.provision :ansible do |ansible|
View Vagrantfile
Vagrant.configure(2) do |config|
config.vm.box = "ubuntu/trusty64"
config.vm.network "forwarded_port", guest: 80, host: 8080
config.vm.provider "virtualbox" do |vb|
# Display the VirtualBox GUI when booting the machine
vb.gui = false
vb.memory = "512"
end
end
@mmarcon
mmarcon / CollectionUtils.java
Created Sep 22, 2013
Maps are not Parcelable and this is an issue in Android when they need to be passed to activities and services via Intents. The corresponding Map-like object in Android is the Bundle. Bundle is a more generic container, it doesn't enforce types via generics and isn't supported natively by JSON deserializers such as Gson. This utility class expos…
View CollectionUtils.java
package es.cloudey.pagespeed.util;
import java.util.HashMap;
import java.util.Map;
import android.os.Bundle;
import android.os.Parcelable;
public class CollectionUtils {
public static Bundle toBundle(Map<String, ? extends Parcelable> input) {
@mmarcon
mmarcon / MFArrayList.java
Created Sep 22, 2013
An extension of the ArrayList class that allows mapping and filtering similarly to Array.prototype.map and Array.prototype.filter in JavaScript.
View MFArrayList.java
package es.cloudey.webanalyzer.util;
import java.util.ArrayList;
import java.util.Collection;
public class MFArrayList<E> extends ArrayList<E> {
private static final long serialVersionUID = 7281673743494991943L;
public MFArrayList(){
@mmarcon
mmarcon / DateUtil.java
Last active Dec 23, 2015
milliseconds to pretty date in Java
View DateUtil.java
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Calendar;
public class DateUtil {
public static String getDate(long milliSeconds) {
DateFormat formatter = new SimpleDateFormat("dd/MM/yyyy hh:mm:ss.SSS");
Calendar calendar = Calendar.getInstance();
calendar.setTimeInMillis(milliSeconds);
return formatter.format(calendar.getTime());