Skip to content

Instantly share code, notes, and snippets.

@fortyfivan
fortyfivan / userdata.ps1
Last active March 22, 2018 21:15
EC2 user data script for enrolling a Windows server to ScaleFT
<powershell>
# Write the Enrollment Token
$enrollment_token = "ENROLLMENT_TOKEN"
$enrollment_token_path = "C:\windows\system32\config\systemprofile\AppData\Local\ScaleFT\enrollment.token"
New-Item -ItemType directory -Path (Split-Path $enrollment_token_path -Parent)
$enrollment_token | Out-File $enrollment_token_path -Encoding "ASCII"
# Install ScaleFT Server Tools
$installer_url = "https://dist.scaleft.com/server-tools/windows/latest/ScaleFT-Server-Tools-latest.msi"
$installer_path = [System.IO.Path]::ChangeExtension([System.IO.Path]::GetTempFileName(), ".msi")
@fortyfivan
fortyfivan / userdata.sh
Last active March 26, 2018 15:54
EC2 user data script for enrolling a server to ScaleFT
#! /bin/bash
echo "Add an enrollment token"
sudo mkdir -p /var/lib/sftd
# get enrollment token from app.scaleft.com
echo "ENROLLMENT TOKEN" | sudo tee /var/lib/sftd/enrollment.token
# enter an altname for the server

Keybase proof

I hereby claim:

  • I am fortyfivan on github.
  • I am fortyfivan (https://keybase.io/fortyfivan) on keybase.
  • I have a public key ASDfmG9gGBFsbTU28o8WTvd0K8Sk6jivhtBQenPQOrGKVAo

To claim this, I am signing this object:

kind: "DeploymentConfig"
apiVersion: "v1"
metadata:
name: "runner"
spec:
template:
metadata:
labels:
name: "runner"
spec:
{
"to": "ivan@iron.io",
"from": "no-reply@iron.io",
"subject": "Hello",
"text": "Hello from Iron.io"
}
source 'https://rubygems.org'
gem 'iron_worker'
gem 'sendgrid-ruby'
FROM iron/ruby
WORKDIR /app
ADD . /app
ENTRYPOINT ["ruby", "email.rb"]
require_relative 'bundle/bundler/setup'
require 'iron_worker'
require 'sendgrid-ruby'
client = SendGrid::Client.new(api_key: 'SENDGRID_APIKEY')
mail = SendGrid::Mail.new do |m|
m.to = IronWorker.payload["to"]
m.from = IronWorker.payload["from"]
m.subject = IronWorker.payload["subject"]
package main
import (
"crypto/aes"
"crypto/cipher"
"crypto/rand"
"encoding/base64"
"errors"
"fmt"
"io"
require_relative 'bundle/bundler/setup'
require 'openssl'
require 'base64'
require 'iron_worker'
KEY = "IRONWORKERDEMOKEY"
ALGORITHM = 'AES-128-ECB'
def encryption(msg)