Skip to content

Instantly share code, notes, and snippets.

View lgs's full-sized avatar

Luca G. Soave lgs

View GitHub Profile
@lgs
lgs / cloud-config.yaml
Created November 3, 2015 19:50 — forked from janeczku/cloud-config.yaml
RancherOS iPXE boot script and cloud-config. Ramdisk based deployment with persistent storage on disk. Configures private IP on eth1 from EC2 metadata.
#cloud-config
hostname: rancher-os
ssh_authorized_keys:
- ssh-rsa AAAABBBBBBCCCCCCC...
write_files:
- path: /opt/rancher/bin/start.sh
permissions: 0700
content: |
#!/bin/bash
# Configure private network on eth1
@lgs
lgs / docker-orientation-for-node-developers.md
Created September 29, 2015 18:11 — forked from subfuzion/docker-orientation-for-node-developers.md
Docker Orientation for Node Developers

Quick Start for getting acquainted with Docker for Node.js developers

Install Dependencies

Install Docker Toolbox

For Mac and Windows users, just install Docker Toolbox. It provides what you need to get started, including:

@lgs
lgs / gist:ba74356d870e24bd156f
Last active August 26, 2015 16:38 — forked from michfield/gist:4525251
Clone all GitHub repositories of a user #bash
@lgs
lgs / README.md
Last active August 29, 2015 14:27 — forked from gdamjan/README.md
Setup for an easy to use, simple reverse http tunnels with nginx and ssh. It's that simple there's no authentication at all. The end result, a single ssh command invocation gives you a public url for your web app hosted on your laptop.

What

A lot of times you are developing a web application on your own laptop or home computer and would like to demo it to the public. Most of those times you are behind a router/firewall and you don't have a public IP address. Instead of configuring routers (often not possible), this solution gives you a public URL that's reverse tunnelled via ssh to your laptop.

Because of the relaxation of the sshd setup, it's best used on a dedicated virtual machine just for this (an Amazon micro instance for example).

Requirements

@lgs
lgs / README.md
Last active August 29, 2015 14:27 — forked from mm53bar/README.md
Using Cloudfront CDN with a rails app

Using Cloudfront CDN with a Rails app

Stop serving assets from your own nginx instance. Instead, let Cloudfront CDN do it for you.

Steps:

  1. Read http://ryantownsend.co.uk/post/13126016608/cloudfront-cdn-on-rails
  2. Set up your nginx virtual host according to the snippet I've included in nginx_vhost.conf
  3. Set up your rails app to use an asset host as described in the article. I've included my config in production.rb
consul-stack:
series: trusty
services:
haproxy:
charm: "local:trusty/haproxy"
etcd:
charm: "local:trusty/etcd"
num_units: 3
to: [0, docker, docker]
registrator:
@lgs
lgs / nginx-rails
Last active August 29, 2015 14:27 — forked from astrauka/nginx-rails
nginx
# assumming path to nginx is /etc/nginx/
sudo su
cd /etx/nginx
mkdir certs_localhost
cd certs_localhost
# generate self signed certificate, the identifier for it should be localhost
openssl req -x509 -newkey rsa:2048 -keyout development.key -out development.crt -days 5000 -nodes
cd ..
@lgs
lgs / common.yml
Last active August 29, 2015 14:26 — forked from akurkin/common.yml
ROSI docker-compose.yml
#
# Shared definition of ruby microservice
#
microservice:
command: "runsvdir /etc/service"
environment:
PORT: 3000
RAILS_ENV: development
SERVICE_PLATFORM: "mia"
ports:
@lgs
lgs / udp-port-scanning.txt
Last active August 29, 2015 14:25 — forked from benhosmer/udp-port-scanning.txt
UDP Port Troubleshooting using netcat
Using the nc command you can scan a port or a range of ports to verify whether a UDP port is open and able to receive traffic.
This first command will scan all of the UDP ports from 1 to 65535 and add the results to a text file:
$ nc -vnzu server.ip.address.here 1-65535 > udp-scan-results.txt
This merely tells you that the UDP ports are open and receive traffic.
Perhaps a more revealing test would be to actually transfer a file using UDP.
# SSL self signed localhost for rails start to finish, no red warnings.
# 1) Create your private key (any password will do, we remove it below)
$ openssl genrsa -des3 -out server.orig.key 2048
# 2) Remove the password
$ openssl rsa -in server.orig.key -out server.key