This file contains 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
// metriks is the local instance of metrics.Metrics | |
var metriks *metrics.Metrics | |
// lock synchronizes access to the metrics sink | |
var lock = sync.RWMutex{} | |
// NewMetrics initializes goa's metrics instance with the supplied | |
// configuration and metrics sink | |
func SetMetrics(m metrics.Metrics) { | |
lock.Lock() |
This file contains 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
package test | |
import ( | |
"bytes" | |
"fmt" | |
"io" | |
"log" | |
"net/http" | |
"net/http/httptest" | |
"regexp" |
This file contains 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
Response(OK, func() { | |
Media(CollectionOf(Bottle, func() { View("tiny") }), "tiny") | |
}) |
This file contains 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
package log | |
/**************** Types ****************/ | |
// The logger interface supports Printf and Structured logging | |
type Logger interface { | |
// fmt.PrintXX style | |
Printf(fmt string, vals ...interface{}) | |
// Structured style |
This file contains 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
require 'rubygems' | |
require 'ruote' | |
require 'flexmock' | |
require 'spec' | |
# Workitem fields validation | |
# This participant validates the fields of the current workitem | |
# Especially useful to validate the initial workitem | |
# An input definition may include the following: | |
# - name: Input name, compulsory |
This file contains 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
require 'thread' | |
# for the Queue class | |
require 'rubygems' | |
require 'yajl' | |
require 'ruote' | |
PDEF = Ruote.process_definition do |
This file contains 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
puts "Synchronous read: #{File.read('/sys/block/ram0/size')}" | |
puts "Asynchronous read..." | |
t = Thread.new do | |
puts File.read('/sys/block/ram0/size') | |
puts 'Done reading' | |
end | |
t.join |
This file contains 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
#include <sys/types.h> /* See NOTES */ | |
#include <sys/socket.h> | |
#include <unistd.h> | |
#include <stdio.h> | |
#include <errno.h> | |
int main() { | |
int fd[2]; | |
int r = pipe(fd); | |
if (getsockopt(fd[0], SOL_SOCKET, 0, NULL,NULL) == ENOTSOCK) { |
This file contains 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
munmap(0x7f7f9e340000, 4096) = 0 | |
dup2(27, 2) = 2 | |
select(31, [3 28 30], [], NULL, {0, 90000}) = 2 (in [28 30], left {0, 90000}) | |
read(28, "456", 16384) = 3 | |
read(28, "", 16384) = 0 | |
read(30, "123", 16383) = 3 | |
read(30, "", 16383) = 0 | |
select(31, [3 28 30], [], NULL, {0, 90000}) = 2 (in [28 30], left {0, 90000}) | |
read(28, "", 16384) = 0 | |
read(30, "", 16383) = 0 |
This file contains 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
Program received signal SIGPIPE, Broken pipe. | |
0x95f831da in write$NOCANCEL$UNIX2003 () | |
(gdb) backtrace | |
#0 0x95f831da in write$NOCANCEL$UNIX2003 () | |
#1 0x95f83132 in _swrite () | |
#2 0x95f52f41 in __sfvwrite () | |
#3 0x95fa9844 in fwrite$UNIX2003 () | |
#4 0x96ecbef1 in __gnu_cxx::__verbose_terminate_handler () | |
#5 0x96eca10c in __gxx_personality_v0 () | |
#6 0x96eca14b in std::terminate () |
NewerOlder