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 / blackhole.sh
Last active August 29, 2015 14:13
A braindead simple bash script for systemd hosts that uses etcd to track whitelisted and blacklisted IPs before running: ip route add blacklist $ip
#!/bin/bash
set -eo pipefail
case $1 in
stop)
if [ ! -f /var/run/blackhole.pid ] ; then
echo "Lack of /var/run/blackhole.pid means there is nothing to stop" 1>&2
exit 1
fi
kill $(cat /var/run/blackhole.pid)
@ianblenke
ianblenke / deis-backup.sh
Created January 18, 2015 05:43
Script for backing up deis ceph buckets to S3
#!/bin/bash
# File: deis-backup.sh
# Author: Ian Blenke
# License: Apache License, Version 2.0
#
# Note: This script is meant to be run under CoreOS "toolbox", as it uses the /media mount and talks locally to etcd to obtain Deis ceph credentials.
# Error out whenever something returns a non-zero errno
set -eo pipefail
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)
@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:
name := "Lab1a"
version := "1.0"
scalaVersion := "2.10.4"
libraryDependencies += "org.apache.spark" %% "spark-core" % "1.1.1"
@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'
}
@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
<#
.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 / 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):
#
@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