Skip to content

Instantly share code, notes, and snippets.

Christoph Klocker corck

Block or report user

Report or block corck

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:369045
#!/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 Nov 28, 2010
Simple script for creating snapshots of an EBS volume and keeping a certain number of those
View AWS - EBS Snapshot Management
#!/usr/local/bin/ruby
require 'AWS'
require 'yaml'
class SnapshotManagement
# initalize class, optional override path to yml file
# * options [String] :path ('')
#
def initialize(params = {})
View devise.de.yml
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.'
View list_of_countries.rb
COUNTRIES = [
"Afghanistan",
"Aland Islands",
"Albania",
"Algeria",
"American Samoa",
"Andorra",
"Angola",
"Anguilla",
"Antarctica",
View country-list-german.html
<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 Mar 26, 2012
Create and upload AMI - Rake task
View create_and_upload_ami
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 Jan 13, 2017
Ruby thingsnetwork example mqtt script
View gist:baf400b0598fc2c27e956af9b59ed6d4
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 Feb 6, 2017
Restart Networkmanager on connection reset, restart VPN after network manager restart
View gist:d4c63e3908548963ce2e58b45d9976e2
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!"
View gist:22bb291cc9a9fa6dec673bca2060892b

Configuration

Allow anyonymous

allow_anonymous = on

@corck
corck / lopy-wearic.py
Last active Jun 28, 2018
Lora Lopy wearic smart textile developer kit test. switch on and off leds through Lopy extension board.
View lopy-wearic.py
from network import LoRa
import pycom
import socket
import time
import binascii
import json
from network import WLAN
from network import Bluetooth
bt = Bluetooth()
You can’t perform that action at this time.