socat
が便利だったのでメモ。
socat [options] <address> <address>
一方の address から入ってきたデータを他方の address に流すツール。 address には様々なデータストリームを指定できる。(標準入出力, TCP, UDP, ファイル, コマンドなど)
普通は address は read/write モードでオープンされる。
#!/bin/sh | |
set -xe | |
sudo apt-get update | |
sudo apt-get install -y wget build-essential openjdk-7-jdk cmake maven pkg-config libssl-dev | |
# install protobuf | |
cd | |
wget https://protobuf.googlecode.com/files/protobuf-2.5.0.tar.gz |
#!/bin/sh -e | |
if [ "$1" = "" ]; then | |
echo "Usage: lxc-ssh NAME [ARGS]" | |
exit 1 | |
fi | |
NAME=$1 | |
ADDR=$(sudo lxc-info -n $NAME | awk -F': *' '/^IP:/ { print $2 }') | |
shift |
#!/usr/bin/python | |
from argparse import ArgumentParser, REMAINDER | |
import os | |
import select | |
from subprocess import Popen, PIPE | |
import sys | |
def read_and_write(poll, rem, files, label): | |
for fd, _ in poll.poll(): | |
buf = os.read(fd, 1024) |
socat
が便利だったのでメモ。
socat [options] <address> <address>
一方の address から入ってきたデータを他方の address に流すツール。 address には様々なデータストリームを指定できる。(標準入出力, TCP, UDP, ファイル, コマンドなど)
普通は address は read/write モードでオープンされる。
--- /usr/share/lxc/templates/lxc-ubuntu 2014-04-15 00:49:58.000000000 +0900 | |
+++ /usr/share/lxc/templates/lxc-ubuntu-nojima 2014-06-22 18:03:15.209620112 +0900 | |
@@ -53,21 +53,41 @@ | |
release=$3 | |
user=$4 | |
password=$5 | |
# configure the network using the dhcp | |
- cat <<EOF > $rootfs/etc/network/interfaces | |
+ ipaddr=$(sed -e 's/#.*$//' /etc/hosts | awk "\$2~/^${hostname}\$/ { print \$1 }") |
#!/bin/sh | |
if [ $# -ne 1 ]; then | |
echo "Usage: create-container NAME" 1>&2 | |
exit 1 | |
fi | |
name=$1 | |
ipaddr=$(sed -e 's/#.*$//' /etc/hosts | awk "\$2~/^${name}\$/ { print \$1 }") | |
if [ -z "$ipaddr" ]; then | |
echo "ERROR: IP address of ${name} was not found in /etc/hosts." 1>&2 | |
exit 1 |
NeoBundle 'scrooloose/syntastic'
...
" syntastic {{{
let g:syntastic_cpp_compiler = 'g++'
let g:syntastic_cpp_compiler_options = ' -std=gnu++11 -DCACHELINE_SIZE=64'
(define rnd 123456) | |
(define (flatten xs) | |
(if (null? xs) | |
() | |
(append (car xs) (flatten (cdr xs))))) | |
(define (field-ref field w y x) | |
(vector-ref field (+ (* y w) x))) | |
(define (field-set field w y x value) |
DUM 111 ; 0 | |
LDC 0 ; 0 | |
LDC 0 ; 0 | |
LDC 0 ; 0 | |
LDC 0 ; 0 | |
LDC 0 ; 0 | |
LDC 0 ; 0 | |
LDC 0 ; 0 | |
LDC 0 ; 0 | |
LDC 0 ; 0 |