Skip to content

Instantly share code, notes, and snippets.

View lgs's full-sized avatar

Luca G. Soave lgs

View GitHub Profile
# 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
@lgs
lgs / curl.md
Last active August 29, 2015 14:22 — forked from btoone/curl.md

Introduction

An introduction to curl using GitHub's API

The Basics

Makes a basic GET request to the specifed URI

curl https://api.github.com/users/caspyin
@lgs
lgs / docker-update
Last active August 29, 2015 14:14 — forked from vaab/docker-update
#!/bin/bash
## Updates an existing image with given script coming from stdin.
##
exname=$(basename $0)
usage="$exname DOCKER_IMAGE
Update image with stdin instruction.
<html>
<head>
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script type="text/javascript">
google.load("visualization", "1.1", {packages:["bar"]});
google.setOnLoadCallback(drawChart);
function drawChart() {
var data = google.visualization.arrayToDataTable([
['Year', 'Sales', 'Expenses', 'Profit'],
['2014', 1000, 400, 200],
#### Rails s with Pry debugger
Started GET "/sub" for 127.0.0.1 at 2014-12-19 21:15:57 +0100
Processing by PagesController#sub as HTML
User Load (0.1ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? ORDER BY "users"."id" ASC LIMIT 1 [["id", 2]]
SubscriptionPlan Load (0.1ms) SELECT "subscription_plans".* FROM "subscription_plans" WHERE "subscription_plans"."id" = ? LIMIT 1 [["id", 1]]
From: /home/lsoave/Github/querier/app/controllers/pages_controller.rb @ line 22 PagesController#sub:
16: def sub
RAILS CONSOLE SESSION:
irb(main):016:0> SubscriptionPlan.create(amount: 1000, interval: "month", stripe_id: "test-plan", name: "Test Plan")
(0.2ms) begin transaction
SubscriptionPlan Exists (0.3ms) SELECT 1 AS one FROM "subscription_plans" WHERE "subscription_plans"."stripe_id" = 'test-plan' LIMIT 1
SQL (0.6ms) INSERT INTO "subscription_plans" ("amount", "interval", "stripe_id", "name", "created_at", "updated_at") VALUES (?, ?, ?, ?, ?, ?) [["amount", 1000], ["interval", "month"], ["stripe_id", "test-plan"], ["name", "Test Plan"], ["created_at", "2014-12-19 15:12:03.338728"], ["updated_at", "2014-12-19 15:12:03.338728"]]
(146.6ms) commit transaction
=> #<SubscriptionPlan id: 1, amount: 1000, interval: "month", stripe_id: "test-plan", name: "Test Plan", interval_count: nil, trial_period_days: nil, created_at: "2014-12-19 15:12:03", updated_at: "2014-12-19 15:12:03">
irb(main):017:0>
irb(main):003:0> SubscriptionPlan.first
SubscriptionPlan Load (0.4ms) SELECT "subscription_plans".* FROM "subscription_plans" ORDER BY "subscription_plans"."id" ASC LIMIT 1
=> nil
irb(main):004:0> SubscriptionPlan.create(amount: 1000, interval: "month", stripe_id: "test-plan", name: "Test Plan")
(0.2ms) begin transaction
SubscriptionPlan Exists (0.3ms) SELECT 1 AS one FROM "subscription_plans" WHERE "subscription_plans"."stripe_id" = 'test-plan' LIMIT 1
(0.2ms) rollback transaction
Stripe::InvalidRequestError: (Status 400) Plan already exists.
@lgs
lgs / README.md
Last active August 29, 2015 14:10 — forked from andyshinn/README.md

Terraform, CoreOS, and Digital Ocean

Let's use Terraform to easily get a CoreOS cluster up on Digital Ocean. In this example we will get a 5 node CoreOS cluster up and running on the Digital Ocean 8GB size.

Install Terraform

Grab a copy of Terraform for your platform from http://www.terraform.io/downloads.html. Follow the instructions at http://www.terraform.io/intro/getting-started/install.html by getting Terraform in your PATH and testing that it works.

Digital Ocean API Key

Netmask Netmask (binary) CIDR Notes
_____________________________________________________________________________
255.255.255.255 11111111.11111111.11111111.11111111 /32 Host (single addr)
255.255.255.254 11111111.11111111.11111111.11111110 /31 Unuseable
255.255.255.252 11111111.11111111.11111111.11111100 /30 2 useable
255.255.255.248 11111111.11111111.11111111.11111000 /29 6 useable
255.255.255.240 11111111.11111111.11111111.11110000 /28 14 useable
255.255.255.224 11111111.11111111.11111111.11100000 /27 30 useable
@lgs
lgs / README.md
Last active August 29, 2015 14:09 — forked from andyshinn/README.md

Terraform, CoreOS, and Digital Ocean

Let's use Terraform to easily get a CoreOS cluster up on Digital Ocean. In this example we will get a 5 node CoreOS cluster up and running on the Digital Ocean 8GB size.

Install Terraform

Grab a copy of Terraform for your platform from http://www.terraform.io/downloads.html. Follow the instructions at http://www.terraform.io/intro/getting-started/install.html by getting Terraform in your PATH and testing that it works.

Digital Ocean API Key