Skip to content

Instantly share code, notes, and snippets.

{
"name":"shell",
"version":"0.0.1",
"description":"Run shell scripts remotely",
"listener": {"channel":"WebChannel","event":"Receiver","params":{}},
"start":{
"target":"id=maciej",
"channel":"ShellChannel",
"method":"Command",
"params":{"command":"{{start.command}}"},
@skierkowski
skierkowski / deploy-to-heroku-without-git.rb
Created February 18, 2013 05:30
Very basic example of deploying to Heroku without git
require 'json'
require 'rest-client'
require 'heroku'
require "heroku/command/base"
require "anvil"
require "anvil/engine"
require "uri"
class Cisaurus
<Response>
<Say>Welcome to Ski's Conference Number</Say>
<Dial><Conference>Ski</Conference></Dial>
</Response>
-if current_user
:javascript
analytics.identify("#{current_user.id}",{
email:"#{current_user.email}",
created:"#{current_user.created_at}",
name:"#{current_user.name}"
},{
Intercom:{userHash:"#{OpenSSL::HMAC.hexdigest('sha256', 'mKz-[removed]', current_user.email)}"}
});
@skierkowski
skierkowski / factor_service_dsl.rb
Created September 3, 2013 22:25
DSL for creating custom integrations for Factor.io
service do
id "github"
name "Github"
version "1.1"
description "Interact with Github.com"
auth_type ""
listener do
id "push"
name "Push"
@skierkowski
skierkowski / deploy_github_to_racksace.rb
Last active December 23, 2015 20:19
Defines a DSL-based workflow in Factor.io to automatically deploy code to a collection of Rackspace servers tagged `www-front-end` whenever new code is pushed/merged to the `factor-io/console` repo in Github.
name 'Deploy console app to servers using Capistrano then notify using Hipchat'
channel 'github'
channel 'capistrano'
channel 'hipchat'
# creates a listener to listen for a push event from github on `factor-io/console` repo
Github.push repo:"factor-io/console" do |start_params|
Capistrano.deploy environment:'production' do |deploy_params|
Hipchat.send message:"Finished deploying #{deploy_params[:release]}"
@skierkowski
skierkowski / gist:7314993
Created November 5, 2013 06:59
This is a snippet of the Factor.io Channel DSL for defining authentication/authorization for Heroku
auth_type "oauth"
oauth_credentials do
key "[oauth-id]"
secret "[oauth-secret]"
expose false
scope "write-protected"
options {
site:"https://heroku.com",
authorize_url:"https://id.heroku.com/oauth/authorize",
token_url:"https://id.heroku.com/oauth/token"}
@skierkowski
skierkowski / docker-attach.rb
Created December 6, 2013 23:28
Sample code of calling Docker remote server with docker-api gem.
require 'docker'
url="tcp://XXX.XXX.XXX.XXX:4243"
command="while true; do echo hello world; sleep 1; done"
Docker.url=url
image = Docker::Image.all.select{|i| i.info["Repository"]=="base" && i.info["Tag"]=="latest" }.first
begin
container = image.run(command)
@skierkowski
skierkowski / deploy_cap_fog_tags.rb
Last active December 30, 2015 22:39
Capistrano Deploying into production on AWS using Fog and tags
require 'fog'
set :stage, :production
aws_settings={
:provider=>"AWS",
:aws_access_key_id=>ENV["AWS_ACCESS_KEY"],
:aws_secret_access_key=>ENV["AWS_SECRET_KEY"]}
compute = Fog::Compute.new(aws_settings)
@skierkowski
skierkowski / nice-pallet.rb
Last active August 29, 2015 13:57
In my code I have an array of unknown length (size). I wanted to create a set of colors for each of the items in the array such that they would always be complimentary to each other. As such, this method basically takes a starting color (#0000FF) (blue), and rotates around the color circle at an angel to make a perfect distribution. I then light…
require 'paleta'
require 'paint'
def generate_nice_colors(size)
colors=Array.new(size)
increment=360/size
colors.map!.with_index do |c, i|
if i==0
c=Paleta::Color.new(:hex, "3030FF")
else