Prints outage statistics from ping output
ping 8.8.8.8 | ts '%s' | ./outageReport.rb
function swift | |
set developer_dir $DEVELOPER_DIR | |
set -x DEVELOPER_DIR /Applications/Xcode6-Beta.app/Contents/Developer/ | |
xcrun swift | |
if echo $developer_dir | grep "/" | |
set -x DEVELOPER_DIR $developer_dir | |
else | |
set -e DEVELOPER_DIR | |
end | |
end |
import Foundation | |
struct SetGenerator<T:Hashable> : Generator { | |
var backingGenerator: DictionaryGenerator<T, Void> | |
init(backingGenerator: DictionaryGenerator<T, Void>) { | |
self.backingGenerator = backingGenerator; | |
} |
infix operator **: MultiplicationPrecedence | |
public func **<T: UnsignedInteger>(base: T, exponent: T) -> T { | |
return pow(base, exponent) | |
} | |
/// Implements pow() for integers using exponentiation by squaring | |
public func pow<T: BinaryInteger, U: UnsignedInteger>(_ base: T, _ exponent: U) -> T { | |
var result: T = 1 |
def get_local_timezone_str | |
# Yes, this is actually a shell script… | |
olsontz = `if [ -f /etc/timezone ]; then | |
cat /etc/timezone | |
elif [ -h /etc/localtime ]; then | |
readlink /etc/localtime | sed "s/\\/usr\\/share\\/zoneinfo\\///" | |
else | |
checksum=\`md5sum /etc/localtime | cut -d' ' -f1\` | |
find /usr/share/zoneinfo/ -type f -exec md5sum {} \\; | grep "^$checksum" | sed "s/.*\\/usr\\/share\\/zoneinfo\\///" | head -n 1 | |
fi`.chomp |
#include "scheduler.h" | |
#include <stddef.h> | |
#include <stdbool.h> | |
// | |
// Compatibility macros | |
// | |
// Missing from Arduino toolchain | |
#ifndef UINT16_MAX |
func ==<T:Feed>(lhs: T, rhs: T) -> Bool { | |
return lhs.link == rhs.link | |
} | |
protocol Feed : Equatable { | |
var link : String {get} | |
} | |
protocol Folder { | |
typealias FeedType: Feed |
import Darwin // Provides: sin/cos/tan | |
// memoize function from https://gist.github.com/berkus/8a9e104f8aac5d025eb5 | |
func memoize<T: Hashable, U>( body: ( (T)->U, T )->U ) -> (T)->U { | |
var memo = Dictionary<T, U>() | |
var result: ((T)->U)! | |
result = { x in | |
if let q = memo[x] { return q } | |
let r = body(result, x) | |
memo[x] = r |
[ | |
{ | |
"name": "Model Z70", | |
"switchMount": "cherry", | |
"plate": true | |
}, | |
[ | |
"~\n`", | |
{ | |
"a": 0 |
// What is an alias method? | |
// If we have a list of elements with different frequencies, | |
// like the letters in the English language… | |
let frequencies = [ | |
("a", 8.167), ("b", 1.492), ("c", 2.782), ("d", 4.253), ("e", 12.702), | |
("f", 2.228), ("g", 2.015), ("h", 6.094), ("i", 6.966), ("j", 0.153), | |
("k", 0.772), ("l", 4.025), ("m", 2.406), ("n", 6.749), ("o", 7.507), | |
("p", 1.929), ("q", 0.095), ("r", 5.987), ("s", 6.327), ("t", 9.056), | |
("u", 2.758), ("v", 0.978), ("w", 2.360), ("x", 0.150), ("y", 1.974), |