Skip to content

Instantly share code, notes, and snippets.

module Ephemeral
module Resources
class Build < Grape::API
def initialize
@builds = {}
end
desc 'Creates a new build'
params do
requires :image, type: String, desc: 'Docker Image ID'
require 'tutum'
require 'awesome_print'
require 'securerandom'
t = Tutum.new('skierkowski', '...')
repo = 'https://github.com/skierkowski/hello-middleman/archive/master.zip'
commands = [
'apt-get update',
@skierkowski
skierkowski / 1-pivotal-tracker-issue.md
Last active August 29, 2015 14:13
tracker_api gem issue

Code that worked yesterday seems to be throwing a Faraday::TimeoutError error despite no changes. The equivalent curl call seems to work too, so API endpoint should be fine.

curl -X GET -H "X-TrackerToken: $PIVOTAL_TRACKER_API_KEY" -H "User-Agent: Ruby/2.1.3 (x86_64-darwin14.0; ruby) TrackerApi/0.2.6 Faraday/0.9.1" "https://www.pivotaltracker.com/services/v5/projects"
require 'awesome_print'
require 'annealer'
require 'minimization'
content = File.read('./data.csv')
data = content.split("\n").map{|n| n.to_i}
# A little helper class to implement split on an Array
class Array
def split(value)
@skierkowski
skierkowski / sublime-settings-default.json
Last active August 29, 2015 14:10
My sublime settings
// While you can edit this file, it's best to put your changes in
// "User/Preferences.sublime-settings", which overrides the settings in here.
//
// Settings may also be placed in file type specific options files, for
// example, in Packages/Python/Python.sublime-settings for python files.
{
// Sets the colors used within the text area
"color_scheme": "Packages/Color Scheme - Default/Monokai.tmTheme",
// Note that the font_face and font_size are overriden in the platform
require 'rest-client'
require 'json'
## usage:
# Tutum.configure do |c|
# c.username = ''
# c.api_key = ''
# end
#
# c = Tutum::Client.new
@skierkowski
skierkowski / basic-workflow.rb
Created October 17, 2014 21:33
Basic directory for running `factor s`
listen 'web::hook', id:'fire_missiles' do |hook|
run 'rackspace::compute::list', region:'dfw' do |servers|
commands = ['ls -al','pwd']
servers.each do |server|
run 'rackspace::compute::ssh', id:server.id, region:'dfw', commands:commands if server.key_name
end
end
end
@skierkowski
skierkowski / intro.md
Created August 12, 2014 23:46
Intro test

What is Factor.io?

Factor.io is a simple way to automate developer workflows by defining them programmatically using the Factor.io syntax and running them using the Factor Server.

Show me, don't tell me!

Suppose you use Github for source code management, and Heroku for hosting. When you merge code into the master branch of the skierkowski/hello repo it is ready for deployment to Heroku's 'hello' app. We want the deployment to happen automatically.

This workflow can now be described using the Factor.io syntax like this:

listen 'github::push', repo:'skierkowski/hello#master' do |repo|

@skierkowski
skierkowski / .travis.yml
Created July 17, 2014 05:22
A .travis.yml file for building and deploying a mkdocs site to an S3 bucket
language: python
ptyhon:
- "2.7"
branches:
only:
- master
install:
- pip install mkdocs
script:
- mkdocs build
@skierkowski
skierkowski / gitter-github-heroku-deploy.rb
Created June 5, 2014 16:26
This Workflow listens in the factor-io/console room in Gitter for someone to say "deploy xyz" (where 'xyz' is the branch).
listen 'gitter','room_message', room:'factor-io/console', filter:'deploy ([a-zA-Z]*)' do |chat_info|
run 'github','download_repo',repo:'console',username:'factor-io', branch:chat_info['matches'][0] do |repo_info|
run 'heroku','deploy',resource_id:repo_info['resource']['id'], app:'factor-console' do |heroku_info|
run 'gitter','send', room:'factor-io/console', message:"Console deployed, release #{heroku_info['release']}"
end
end
end