View README.md

Prints outage statistics from ping output

Usage

ping 8.8.8.8 | ts '%s' | ./outageReport.rb

Examples:

Packet loss

View plot.swift
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
View RSSKit.swift
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
View scheduler.c
#include "scheduler.h"
#include <stddef.h>
#include <stdbool.h>
//
// Compatibility macros
//
// Missing from Arduino toolchain
#ifndef UINT16_MAX
View there_i_fixed_it.rb
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
View Exponent.swift
operator infix ** { associativity left precedence 160 }
func **(lhs: Double, rhs: Double) -> Double {
return pow(lhs, rhs)
}
func **(lhs: Float, rhs: Float) -> Float {
return powf(lhs, rhs)
}
View Set.swift
import Foundation
struct SetGenerator<T:Hashable> : Generator {
var backingGenerator: DictionaryGenerator<T, Void>
init(backingGenerator: DictionaryGenerator<T, Void>) {
self.backingGenerator = backingGenerator;
}
View swift-repl.fish
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
View UIApplication+DelegateMultiDispatch.h
#import <UIKit/UIKit.h>
@protocol NNApplicationSubscriber <NSObject>
@optional
- (void)applicationDidBecomeActive:(UIApplication *)application;
- (void)application:(UIApplication *)application didChangeStatusBarFrame:(CGRect)oldStatusBarFrame;
- (void)application:(UIApplication *)application didChangeStatusBarOrientation:(UIInterfaceOrientation)oldStatusBarOrientation;
- (void)applicationDidEnterBackground:(UIApplication *)application;
- (void)applicationDidFinishLaunching:(UIApplication *)application;
View gist:9218846
/**
Provides the ability to verify key paths at compile time.
If "keyPath" does not exist, a compile-time error will be generated.
Example:
// Verifies "isFinished" exists on "operation".
NSString *key = SQKeyPath(operation, isFinished);
// Verifies "isFinished" exists on self.