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
#!/usr/bin/python3.5 | |
import asyncio | |
import logging | |
from juju import loop | |
from juju.model import Model, ModelObserver | |
class ModelWatcher(ModelObserver): |
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" | |
"github.com/juju/juju/api" | |
"github.com/juju/juju/juju" | |
"github.com/juju/juju/jujuclient" | |
"github.com/juju/juju/state/multiwatcher" | |
) |
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
const ITERS: usize = 20; | |
fn print_fib(n: usize) { | |
let mut x = (1, 1); | |
for i in 0..n { | |
println!("{}: {}", i, x.0); | |
x = (x.1, x.0 + x.1) | |
} | |
} |
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" | |
"github.com/pkg/errors" | |
) | |
func A() error { | |
// New errors created with pkg/errors.New() will include a full |
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 perf_test | |
/* | |
Results on my machine: | |
BenchmarkSprintf-4 5000000 337 ns/op | |
BenchmarkBuffer-4 5000000 283 ns/op | |
BenchmarkManualAppend-4 20000000 91.0 ns/op | |
BenchmarkLineBuilder-4 10000000 182 ns/op |
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 b | |
import ( | |
"bytes" | |
"testing" | |
) | |
var needsEscape = []byte(`foo\ bar\"sne`) | |
func BenchmarkOrig(b *testing.B) { |
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 perf_test | |
import ( | |
"bytes" | |
"fmt" | |
"strconv" | |
"testing" | |
) | |
var ( |
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" | |
"log" | |
"net/http" | |
"time" | |
) | |
import "flag" |
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
#!/bin/sh | |
if [ $# -ne 2 ]; then | |
echo "usage: sshj <jump_host> <target>" | |
exit 1 | |
fi | |
exec ssh -o ProxyCommand="ssh -W %h:%p $1" "$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
#!/bin/sh | |
if [ $# -lt 3 ]; then | |
echo "usage: sshj <jump_host> <source> <target>" | |
exit 1 | |
fi | |
jump=$1 | |
shift |