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
func Download(out chan string, urls... string) { | |
for url := range(urls) { | |
go func() { | |
out <- HttpGet(url) | |
}() | |
} | |
} | |
func Process(in chan string) { | |
select { |
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 foo | |
import "fmt" | |
func NewThing() *Thing { | |
return &Thing{ | |
Name: "Thing", | |
other: make(other), | |
} | |
} |
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" | |
// Swap these 2 for comparison. Under Go 1.6 the program works | |
// with json but not yaml. | |
"gopkg.in/yaml.v2" | |
// yaml "encoding/json" | |
) |
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
# listen on 127.0.0.1 so that apt on the host machine can use the cache | |
http_port 127.0.0.1:8888 | |
# listen on lxdbr0 addresses | |
http_port 10.0.8.1:8888 | |
http_port [fdc1:e6b1:6aac:99f5::1]:8888 | |
acl allowed_src_networks src "/etc/squid-deb-proxy/autogenerated/allowed-networks-src.acl" | |
acl blockedpkgs urlpath_regex "/etc/squid-deb-proxy/autogenerated/pkg-blacklist-regexp.acl" |
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/perl | |
$mirror = "nz.archive.ubuntu.com"; | |
#$mirror = "us.archive.ubuntu.com"; | |
# For Cape Town | |
#$mirror = "ubuntu.saix.net/ubuntu-archive"; | |
$| = 1; | |
while (<>) { | |
@line = split; |
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/bash | |
model=${1:-controller} | |
machine=${2:-0} | |
read -d '' -r cmds <<'EOF' | |
password=`sudo grep oldpassword /var/lib/juju/agents/machine-*/agent.conf | cut -d' ' -f2` | |
/usr/lib/juju/mongo*/bin/mongo 127.0.0.1:37017/juju --authenticationDatabase admin --ssl --sslAllowInvalidCertificates --username "admin" --password "$password" | |
EOF |
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
import time | |
from logging import getLogger | |
from logging.handlers import SysLogHandler | |
logger = getLogger() | |
logger.addHandler(SysLogHandler("/dev/log")) | |
while True: | |
print time.asctime() | |
logger.error("x" * 200) |
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" | |
"net/http" | |
"net/url" | |
"sync" | |
) | |
type ProxyConfig struct { |
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
imap = imapclient.IMAPClient(server) | |
imap.login(username, getpass()) | |
imap.select_folder('INBOX') | |
messages = imap.search(['NOT', 'DELETED']) | |
for message_id, data in imap.fetch(messages, ['RFC822']).iteritems(): | |
body = data['RFC822'] | |
# do stuff with message_id and body... | |
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/api/controller" | |
"github.com/juju/juju/juju" | |
"github.com/juju/juju/jujuclient" | |
"github.com/kr/pretty" |
OlderNewer