This file contains hidden or 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 asyncsocket; | |
import java.io.IOException; | |
import java.io.UnsupportedEncodingException; | |
import java.net.InetSocketAddress; | |
import java.nio.ByteBuffer; | |
import java.nio.channels.AsynchronousSocketChannel; | |
import java.nio.channels.CompletionHandler; | |
import java.util.concurrent.atomic.AtomicInteger; |
This file contains hidden or 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
#define FDB_API_VERSION 200 | |
#include <foundationdb/fdb_c.h> | |
#include <iostream> | |
#include <thread> | |
#include <string> | |
#include <unistd.h> | |
void init() { | |
fdb_error_t err = fdb_select_api_version( FDB_API_VERSION ); |
This file contains hidden or 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 java.nio.ByteBuffer; | |
import java.nio.channels.AsynchronousSocketChannel; | |
import java.nio.channels.CompletionHandler; | |
import java.util.LinkedList; | |
import java.util.concurrent.TimeUnit; | |
/** | |
* This class wraps the AsynchronousSocketChannel reading and writing operations. The wrapped reading and writing operations is | |
* completely asynchronous operation. No any exception will be thrown from the read/write operation. If any exception occurs | |
* during read & write, the failed() method in CompletionHandler will be called. |
This file contains hidden or 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
If the coreos is deployed behind a proxy, we can simply use following steps to make docker work: | |
1) copy the /usr/lib/systemd/system/docker.service to /etc/systemd/system/ directory | |
sudo cp /usr/lib/systemd/system/docker.service /etc/systemd/system/ | |
2) edit the /etc/systemd/system/docker.service file and add | |
Environment="HTTP_PROXY=http://proxy.example.com:8080" |
This file contains hidden or 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
<?xml version="1.0"?> | |
<!-- | |
** DO NOT EDIT THIS FILE. | |
** If you make changes to this file while any VirtualBox related application | |
** is running, your changes will be overwritten later, without taking effect. | |
** Use VBoxManage or the VirtualBox Manager GUI to make changes. | |
--> | |
<VirtualBox xmlns="http://www.innotek.de/VirtualBox-settings" version="1.12-linux"> | |
<Global> | |
<ExtraData> |
This file contains hidden or 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
1) edit file /var/lib/boot2docker/profile, and add the proxy setting lines to the file | |
export HTTP_PROXY=http://<proxy host>:<port> | |
export HTTPS_PROXY=https://<proxy host>:<port> | |
2) restart the docker | |
/etc/init.d/docker restart | |
This file contains hidden or 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
1, create a virtual machine from the virtualbox with VDI harddisk | |
2, add a virtual CDROM to the virtual machine and select boot2docker.iso ( the boot2docker.iso should be downloaded before) | |
3, start the virtual machine | |
4, write the boot2docker.iso image to the virtual harddisk using dd command | |
# dd if=/dev/cdrom of=/dev/sda |
This file contains hidden or 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
/* | |
* Copyright (c) 2014 by its authors. Some rights reserved. | |
* | |
* Licensed under the Apache License, Version 2.0 (the "License"); | |
* you may not use this file except in compliance with the License. | |
* You may obtain a copy of the License at | |
* | |
* http://www.apache.org/licenses/LICENSE-2.0 | |
* | |
* Unless required by applicable law or agreed to in writing, software |
This file contains hidden or 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
/* | |
* | |
* Licensed under the Apache License, Version 2.0 (the "License"); | |
* you may not use this file except in compliance with the License. | |
* You may obtain a copy of the License at | |
* | |
* http://www.apache.org/licenses/LICENSE-2.0 | |
* | |
* Unless required by applicable law or agreed to in writing, software | |
* distributed under the License is distributed on an "AS IS" BASIS, |
This file contains hidden or 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
// Goroutine practice | |
package main | |
import ( | |
"fmt" | |
"strconv" | |
"sync" | |
"time" | |
) |