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
case class BinaryTree(left: BinaryTree, right: BinaryTree) | |
def isComplete(tree: BinaryTree): Boolean = { | |
val q = scala.collection.mutable.Queue(tree) | |
var expectNull = false | |
while(!q.isEmpty) { | |
val n = q.dequeue | |
if (n != null) { | |
if (expectNull) { | |
return false |
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 | |
# | |
# This file echoes a bunch of color codes to the | |
# terminal to demonstrate what's available. Each | |
# line is the color code of one forground color, | |
# out of 17 (default + 16 escapes), followed by a | |
# test use of that color on all nine background | |
# colors (default + 8 escapes). | |
# |
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/nova/virt/libvirt/driver.py b/nova/virt/libvirt/driver.py | |
index c849460..891ffe1 100755 | |
--- a/nova/virt/libvirt/driver.py | |
+++ b/nova/virt/libvirt/driver.py | |
@@ -2261,10 +2261,6 @@ class LibvirtDriver(driver.ComputeDriver): | |
# client app is connected. Thus we can't get away | |
# with a single type=pty console. Instead we have | |
# to configure two separate consoles. | |
- consolelog = vconfig.LibvirtConfigGuestSerial() | |
- consolelog.type = "file" |
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 -r d5666bad617d src/pkg/net/file.go | |
--- a/src/pkg/net/file.go Thu Sep 27 15:36:22 2012 -0700 | |
+++ b/src/pkg/net/file.go Wed Apr 24 11:49:35 2013 -0400 | |
@@ -7,10 +7,132 @@ | |
package net | |
import ( | |
+ "errors" | |
+ "io" | |
"os" |
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 ( | |
"database/sql" | |
"encoding/json" | |
"fmt" | |
"github.com/coopernurse/gorp" | |
"github.com/kghost/rss" | |
_ "github.com/mattn/go-sqlite3" | |
"io/ioutil" |
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 | |
for i in {1..20} | |
do | |
for j in {1..20} | |
do | |
echo $((i+j)) $i $j | |
done | |
done | sort -n | while read sum i j | |
do |
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
(let* ((yin | |
((lambda (cc) (write-char #\@ (current-output-port)) cc) (call-with-current-continuation (lambda (c) c)))) | |
(yang | |
((lambda (cc) (write-char #\* (current-output-port)) cc) (call-with-current-continuation (lambda (c) c))))) | |
(yin yang)) |
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 | |
tty -s || exit 1 | |
trap '' 1 2 3 18 | |
stty -echo | |
echo 1b5b313874 | xxd -ps -r | |
read -d t c | |
stty echo |
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
#include <string.h> | |
#include <stdio.h> | |
#include <queue> | |
#define LOWER 0 | |
#define UPPER 10000 | |
#define S_MID_TOP_TO_LEFT 0 | |
#define S_MID_BOTTOM_TO_LEFT 1 | |
#define S_LEFT_TOP_TO_MID 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 info.kghost.test | |
import java.net.InetSocketAddress | |
import java.nio.channels.SelectionKey | |
import java.nio.channels.Selector | |
import java.nio.channels.ServerSocketChannel | |
import java.nio.channels.SocketChannel | |
import java.nio.ByteBuffer | |
import scala.collection.JavaConversions.collectionAsScalaIterable |
NewerOlder