Skip to content

Instantly share code, notes, and snippets.

View ianblenke's full-sized avatar
🎯
Focusing

Ian Blenke ianblenke

🎯
Focusing
View GitHub Profile
@ianblenke
ianblenke / spec_helper.rb
Last active August 29, 2015 14:09
Boot2docker friendly docker-api spec_helper
require "docker"
docker_host = ENV['DOCKER_HOST'].dup
if(ENV['DOCKER_TLS_VERIFY'])
cert_path = File.expand_path ENV['DOCKER_CERT_PATH']
Docker.options = {
client_cert: File.join(cert_path, 'cert.pem'),
client_key: File.join(cert_path, 'key.pem')
}
@ianblenke
ianblenke / dockerfile_spec.rb
Created November 10, 2014 20:07
Dockerfile TDD spec
require "spec_helper"
describe "dockerfile built my_app image" do
before(:all) do
@image = Docker::Image.all(:all => true).find { |image|
Docker::Util.parse_repo_tag( image.info['RepoTags'].first ).first == 'my_app'
}
p @image.json["Env"]
end
@ianblenke
ianblenke / Dockerfile
Created November 10, 2014 20:09
Dockerfile for rails app
FROM rails:onbuild
ENV HOME /usr/src/app
ADD docker/run.sh /run.sh
RUN chmod 755 /run.sh
EXPOSE 3000
CMD /run.sh
@ianblenke
ianblenke / Bootstrap-EC2-Windows-CloudInit.ps1
Last active August 29, 2015 14:10
Fork of a user-data powershell based bootstrapping of AWS deployed Windows instances
# Copied shamelessly from: https://gist.githubusercontent.com/masterzen/6714787/raw/3166173255caef341f578e1ea3fff1eea3072d5b/Bootstrap-EC2-Windows-CloudInit.ps1
# Windows AMIs don't have WinRM enabled by default -- this script will enable WinRM
# AND install 7-zip, curl and .NET 4 if its missing.
# Then use the EC2 tools to create a new AMI from the result, and you have a system
# that will execute user-data as a PowerShell script after the instance fires up!
# This has been tested on Windows 2008 SP2 64bits AMIs provided by Amazon
#
# Inject this as user-data of a Windows 2008 AMI, like this (edit the adminPassword to your needs):
#
<#
.NOTES
===========================================================================
Created with: PowerShell Studio 2014, Version 4.1.74
Created on: 11/10/2014 4:06 PM
Company: SAPIEN Technologies, Inc.
Contact: June Blender, [email protected], @juneb_get_help
Filename: Update-OneGet.ps1
===========================================================================
@ianblenke
ianblenke / InstallUse_OneGet.ps1
Created December 3, 2014 22:06
Powershell install and use OneGet
# Install Microsoft's OneGet and start using it
icm $executioncontext.InvokeCommand.NewScriptBlock((New-Object Net.WebClient).DownloadString('https://gist.githubusercontent.com/ianblenke/27f29e3a4a64f0296abe/raw/428e4a8f043d67a1ecce764c1173856f7b1002be/Update-OneGet.ps1')) -ArgumentList $home\Documents\WindowsPowerShellModules\OneGet
Import-Module $home\Documents\WindowsPowerShellModules\OneGet\OneGet.psd1
@ianblenke
ianblenke / WMF5.ps1
Created December 3, 2014 22:26
Powershell Install WMF 5.0 Preview
if ((Get-CimInstance -ClassName Win32_OperatingSystem).Version -eq '6.3.9600')
{
if ((Get-Ciminstance -ClassName Win32_Processor).Addresswidth -eq '64')
{
$url = 'http://download.microsoft.com/download/5/5/2/55277C4B-75D1-40FB-B99C-4EAFA249F645/WindowsBlue-KB2894868-x64.msu'
}
else
{
$url = 'http://download.microsoft.com/download/5/5/2/55277C4B-75D1-40FB-B99C-4EAFA249F645/WindowsBlue-KB2894868-x86.msu'
}
name := "Lab1a"
version := "1.0"
scalaVersion := "2.10.4"
libraryDependencies += "org.apache.spark" %% "spark-core" % "1.1.1"
@ianblenke
ianblenke / Makefile
Created December 7, 2014 18:20
spark scala Makefile
all: target/scala-2.10/lab1a_2.10-1.0.jar
spark-submit \
--class "Lab1a" \
--master local[4] \
target/scala-2.10/lab1a_2.10-1.0.jar
target/scala-2.10/lab1a_2.10-1.0.jar: lab1a.scala
sbt package
clean:
import org.apache.spark.SparkContext
import org.apache.spark.SparkContext._
import org.apache.spark.SparkConf
object Lab1a {
def main(args: Array[String]) {
val conf = new SparkConf().setAppName("lab1a")
val sc = new SparkContext(conf)