system.cpu.idle
: % Idle CPUsystem.cpu.system
: % System CPUsystem.cpu.user
: % User CPU
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 main | |
import ( | |
"tour/wc" | |
"strings" | |
) | |
func WordCount(s string) map[string]int { | |
words := strings.Fields(s) | |
result := make(map[string]int) |
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 main | |
import "tour/pic" | |
func Pic(dx, dy int) [][]uint8 { | |
m := make([][]uint8, dy, dy) | |
for i := 0; i < dy; i++ { | |
m[i] = make([]uint8, dx, dx) | |
for j := 0; j < dx; j++ { | |
m[i][j] = uint8((i+j)/2) |
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 main | |
import "fmt" | |
// fibonacci is a function that returns | |
// a function that returns an int. | |
func fibonacci() func() int { | |
i, j := 0, 1 | |
return func() int { | |
i, j = j, i+j |
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 main | |
import "fmt" | |
import "math/cmplx" | |
const d float64 = 0.0001 | |
func Cbrt(x complex128) complex128 { | |
z0, z := complex128(0), complex128(1) | |
for cmplx.Abs(z - z0) > d { |
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
sudo sed -i 's/lucid/lucid-0.10/' /etc/apt/sources.list.d/opscode.list && sudo apt-get update && sudo apt-get dist-upgrade -y |
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 'dogapi' | |
# Create a simple client | |
# You typically want to do: | |
# Dogapi::Client.new(your_actual_api_key_as_a_string, ...) | |
dog = Dogapi::Client.new(YOUR_API_KEY_HERE) | |
# Emit a list of points in one go as a list of (timestamp, value) | |
# here we pretend to send a point a minute for the past hour |
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
gawk '/batch_query.*slow/ {d = substr($(NF-1), 3, length($(NF-1))-3); if (d > 5) {print $1, d, $7, $8}}' /mnt/log/mcnulty/dogweb.log |
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
diff --git a/checks/system/unix.py b/checks/system/unix.py | |
index 5ebc6b2..8be6c5c 100644 | |
--- a/checks/system/unix.py | |
+++ b/checks/system/unix.py | |
@@ -626,7 +626,7 @@ class Cpu(Check): | |
def get_value(legend, data, name): | |
"Using the legend and a metric name, get the value or None from the data line" | |
if name in legend: | |
- return float(data[legend.index(name)]) | |
+ return float(data[legend.index(name)].replace(",", ".")) |