Skip to content

Instantly share code, notes, and snippets.

View gionn's full-sized avatar
⚔️

Giovanni Toraldo gionn

⚔️
View GitHub Profile
@gionn
gionn / .gitignore
Last active January 16, 2017 23:53
Infrastructure as Code with Terraform
.env
terraform.tfstate*
@gionn
gionn / tf_ssh_config_gen.rb
Last active December 18, 2018 17:34
Quick script to generate an ssh_config after a terraform apply on OpenStack, GCE, DigitalOcean
#!/usr/bin/env ruby
# NOTICE: GCE and OpenStack providers only.
require 'json'
require 'erb'
def get_template()
%{
<% hosts.each do |key, entry| %>
Host <%= key %>
node_modules
@gionn
gionn / fog_cloudfiles_timeout.md
Last active March 20, 2017 12:52
Fog CloudFiles (Rackspace) reporting timeout errors

If you are getting something like the following, on a box without ipv6 connectivity:

/opt/rbenv/versions/1.9.3-p547/lib/ruby/gems/1.9.1/gems/excon-0.44.4/lib/excon/socket.rb:291:in `raise_timeout_error': read timeout reached (Excon::Errors::Timeout)
	from /opt/rbenv/versions/1.9.3-p547/lib/ruby/gems/1.9.1/gems/excon-0.44.4/lib/excon/socket.rb:49:in `rescue in readline'
	[...]
	from /opt/rbenv/versions/1.9.3-p547/lib/ruby/gems/1.9.1/gems/fog-core-1.29.0/lib/fog/core/connection.rb:81:in `request'
	from /opt/rbenv/versions/1.9.3-p547/lib/ruby/gems/1.9.1/gems/fog-1.28.0/lib/fog/rackspace/service.rb:42:in `request'
	from /opt/rbenv/versions/1.9.3-p547/lib/ruby/gems/1.9.1/gems/fog-1.28.0/lib/fog/rackspace/storage.rb:444:in `request'
	from /opt/rbenv/versions/1.9.3-p547/lib/ruby/gems/1.9.1/gems/fog-1.28.0/lib/fog/rackspace/requests/storage/put_object.rb:35:in `put_object'
@gionn
gionn / Dockerfile
Last active August 29, 2015 14:18
Simple example of Dockerfile for nodejs application
FROM ubuntu:14.04
MAINTAINER Giovanni Toraldo
ENV DEBIAN_FRONTEND noninteractive
RUN sed -i s/archive/it.archive/g /etc/apt/sources.list
RUN apt-get update
RUN apt-get install -y software-properties-common
RUN apt-add-repository ppa:chris-lea/node.js
@gionn
gionn / fabfile.py
Last active November 11, 2017 17:47
Fabric script to manage remote chef-client local_mode nodes. (Deprecated the old chef-solo, it support search API without any additional plugin)
from fabric.api import *
from fabric.colors import *
from fabric.contrib import console
from fabric.operations import prompt
import json
import os
env.colorize_errors = True
env.use_ssh_config = True
env.ssh_config_path = './ssh-config'
@gionn
gionn / application.rb
Created May 28, 2014 16:05
Chef php application example recipe
include_recipe "apache2::default"
include_recipe "apache2::mod_php5"
application 'wordpress' do
path '/var/www'
owner 'www-data'
group 'www-data'
repository 'https://github.com/WordPress/WordPress.git'
revision '3.9.1'
end
@gionn
gionn / mysql.rb
Created May 28, 2014 15:52
Chef mysql example recipe
node.set['mysql']['server_root_password'] = 'yolo'
node.set['mysql']['port'] = '3308'
node.set['mysql']['data_dir'] = '/data'
include_recipe 'mysql::server'
mysql_connection_info = {
:host => 'localhost',
:username => 'root',
:password => node['mysql']['server_root_password']
@gionn
gionn / jclouds-openstack.java
Last active August 29, 2015 14:01
JClouds OpenStack entercloudsuite.com
ComputeServiceContext context = ContextBuilder.newBuilder("openstack-nova")
.credentials(user, password)
.endpoint("https://api-legacy.entercloudsuite.com:5000/v2.0")
.modules(ImmutableSet.<Module> of(new SLF4JLoggingModule(),
new SshjSshClientModule()))
.buildView(ComputeServiceContext.class);
ComputeService computeService = context.getComputeService();
Template template = computeService.getTemplateBuilder()
@gionn
gionn / TATE.md
Last active April 1, 2018 18:36
Root and install cyanogenmod on Kindle Fire HD (2nd generation) codename tate