Skip to content

Instantly share code, notes, and snippets.

View corck's full-sized avatar

Christoph Klocker corck

View GitHub Profile

Configuration

Allow anyonymous

allow_anonymous = on

@corck
corck / gist:baf400b0598fc2c27e956af9b59ed6d4
Last active January 13, 2017 15:48
Ruby thingsnetwork example mqtt script
require 'mqtt'
require 'base64'
require 'json'
app_id = APP_ID
access_key = ACCESS_KEY
dev_id = DEV_ID
region = eu
client = MQTT::Client.connect("mqtt://#{app_id}:#{access_key}@#{region}.thethings.network:1883")
@corck
corck / create_and_upload_ami
Created March 26, 2012 05:09
Create and upload AMI - Rake task
desc "create ami bundle and upload it to s3"
task :create_and_upload_bundle do |channel, stream, data|
set :user, 'app'
message = "Please enter platform [i386|x86_64]"
platform = Capistrano::CLI.ui.ask(message)
message = "Please enter a bundle name:"
bundle_name = Capistrano::CLI.ui.ask(message)
sudo "rm -r /mnt/image; true"
sudo "ec2-bundle-vol -e /volume1,/volume2 -d /mnt -k ~/.ssh/XXXXX.pem -c ~/.ssh/cert-XXXXX.pem -u USERID -r #{platform}"
#sudo "ec2-bundle-vol -d /mnt -k ~/.ssh/XXXXX.pem -c ~/.ssh/cert-XXXX.pem -u USERID -r #{platform}"
COUNTRIES = [
"Afghanistan",
"Aland Islands",
"Albania",
"Algeria",
"American Samoa",
"Andorra",
"Angola",
"Anguilla",
"Antarctica",
de:
errors:
messages:
not_found: "nicht gefunden"
already_confirmed: "wurde bereits bestätigt"
not_locked: "war nicht gesperrt"
devise:
omniauth_callbacks:
success: 'Sie wurden erfolgreich eingeloggt.'
@corck
corck / AWS - EBS Snapshot Management
Created November 28, 2010 10:41
Simple script for creating snapshots of an EBS volume and keeping a certain number of those
#!/usr/local/bin/ruby
require 'AWS'
require 'yaml'
class SnapshotManagement
# initalize class, optional override path to yml file
# * options [String] :path ('')
#
def initialize(params = {})
#!/usr/bin/env ruby
require 'open-uri'
require 'rexml/document'
require 'rexml/xpath'
url = 'http://rpm.newrelic.com/accounts.xml?include=application_health'
headers = {'x-license-key' => 'YOUR LICENSE KEY'}