Skip to content

Instantly share code, notes, and snippets.

View corck's full-sized avatar

Christoph Klocker corck

View GitHub Profile
#!/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'}
@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 = {})
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.'
COUNTRIES = [
"Afghanistan",
"Aland Islands",
"Albania",
"Algeria",
"American Samoa",
"Andorra",
"Angola",
"Anguilla",
"Antarctica",
<select name="country">
<option value="DE" selected>Deutschland</option>
<option value="AT">Österreich</option>
<option value="CH">Schweiz</option>
<optgroup label="A">
<option value="AF">Afghanistan</option>
<option value="EG">Ägypten</option>
<option value="AX">Åland</option>
<option value="AL">Albanien</option>
<option value="DZ">Algerien</option>
@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}"
@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 / gist:d4c63e3908548963ce2e58b45d9976e2
Last active May 6, 2022 21:20
Restart Networkmanager on connection reset, restart VPN after network manager restart
For monitoring Network Manager connection and restart it on a dropped connection (eth/wifi). Make sure to specify the right interface below (eth0, wlan0...)
#/etc/init/reconnect.conf
start on started network-manager
stop on runlevel [016]
script
while true; do
if ifconfig eth0 | grep -q "inet addr:"; then
# echo "all ok!"

Configuration

Allow anyonymous

allow_anonymous = on

@corck
corck / lopy-wearic.py
Last active June 28, 2018 22:10
Lora Lopy wearic smart textile developer kit test. switch on and off leds through Lopy extension board.
from network import LoRa
import pycom
import socket
import time
import binascii
import json
from network import WLAN
from network import Bluetooth
bt = Bluetooth()