This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
helper_method :get_last_commit | |
def get_last_commit | |
require 'cobravsmongoose' | |
require 'open-uri' | |
response = open("http://github.com/api/v1/xml/lennartkoopmann/scopeport-server/commits/master").read | |
commits = CobraVsMongoose.xml_to_hash(response) | |
author_name = commits["commits"]["commit"][0]["author"]["name"]["$"] | |
message = commits["commits"]["commit"][0]["message"]["$"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
helper_method :get_last_commit | |
def get_last_commit | |
require "cobravsmongoose" | |
require "open-uri" | |
require "timeout" | |
retries = 1 | |
response = ""; | |
begin |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def permission? | |
user = current_user | |
controller = params[:controller] | |
action = params[:action] | |
id = params[:id] | |
# Okay, the user is an administrator. Allow all access. | |
return true if user.admin | |
# Fine grained access rules. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/ruby | |
require File.join("/usr/lib/ruby/gems/1.8/gems/octopi-0.0.9/lib/octopi.rb") | |
include Octopi | |
require "mysql" | |
# Connect to database. | |
con = Mysql.real_connect "localhost", "user", "password", "database" | |
# Fetch all repos |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def flip_order_direction str | |
"desc" if str == "asc" | |
"asc" if str == "desc" | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Tue Aug 25 00:59:56 2009 - serviceChecks(): Started | |
Tue Aug 25 00:59:56 2009 - serviceChecks(): In loop. | |
Tue Aug 25 00:59:56 2009 - serviceChecks(): Connected to database. | |
Tue Aug 25 00:59:56 2009 - serviceChecks(): Fetched 1 services that need to get a serviceHandler() | |
Tue Aug 25 00:59:56 2009 - serviceChecks(): Starting serviceHandler() 0 | |
Tue Aug 25 00:59:56 2009 - serviceChecks(): Started serviceHandler() 0 | |
Tue Aug 25 00:59:56 2009 - serviceHandler(): Started. | |
Tue Aug 25 00:59:56 2009 - serviceHandler() 622761: Connected to database. | |
Tue Aug 25 00:59:56 2009 - serviceHandler() 622761: Initial query succeeded. | |
Tue Aug 25 00:59:56 2009 - serviceHandler() 622761: A service to handle has been fetched. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Tue Aug 25 01:02:25 2009 - serviceChecks(): Started | |
Tue Aug 25 01:02:25 2009 - serviceChecks(): In loop. | |
Tue Aug 25 01:02:25 2009 - serviceChecks(): Connected to database. | |
Tue Aug 25 01:02:25 2009 - serviceChecks(): Fetched 1 services that need to get a serviceHandler() | |
Tue Aug 25 01:02:25 2009 - serviceChecks(): Starting serviceHandler() 0 | |
Tue Aug 25 01:02:25 2009 - serviceHandler(): Started. | |
Tue Aug 25 01:02:25 2009 - serviceChecks(): Started serviceHandler() 0 | |
Tue Aug 25 01:02:25 2009 - serviceHandler() 196722: Connected to database. | |
Tue Aug 25 01:02:25 2009 - serviceHandler() 196722: Initial query succeeded. | |
Tue Aug 25 01:02:25 2009 - serviceHandler() 196722: A service to handle has been fetched. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.lang.management.*; | |
import javax.management.*; | |
// ... | |
MBeanServer mbs = ManagementFactory.getPlatformMBeanServer(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
irb(main):001:0> require 'rubygems' | |
=> true | |
irb(main):002:0> require 'gelf' | |
=> true | |
irb(main):003:0> msg = Gelf.new 'localhost', 12201 | |
=> #<Gelf:0xb73a4424 @port=12201, @hostname="localhost"> | |
irb(main):004:0> msg.short_message = "Something is broken" | |
=> "Something is broken" | |
irb(main):005:0> msg.full_message = "Stacktrace\n\nmore stuff" | |
=> "Stacktrace\n\nmore stuff" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require('gelf.php'); | |
$gelf = new GELFMessage('localhost', 12201); | |
$gelf->setShortMessage('Something is broken'); | |
$gelf->setFullMessage("Stacktrace\n\nmore stuff"); | |
$gelf->setHost('my-app'); | |
$gelf->setLevel(1); |
OlderNewer