windows rsyncでエラー
windowsのファイルをlinuxに保存しようとしたとき
rsyncだろ?って思って探していたらcwRsyncがあったので
試したら、思いのほかハマった。
pubキー等々準備して意気揚々と実行したら
C:\Apps\cwRsync\bin>rsync -auzv --rsh="ssh -l root" /cygdrive/c/work/hoge/fuge.php "fumu@192.168.1.1:/home/fumu/work/." usage: ssh [-1246AaCfghkNnqsTtVvXxY] [-b bind_address] [-c cipher_spec] [-D port] [-e escape_char] [-F configfile] [-i identity_file] [-L port:host:hostport] [-l login_name] [-m mac_spec] [-o option] [-p port] [-R port:host:hostport] [user@]hostname [command] rsync: connection unexpectedly closed (0 bytes received so far) [sender] rsync error: error in rsync protocol data stream (code 12) at io.c(226) [sender= 3.1.0]
このエラー。。
意味不明すぎて。。禿げる。。
(某やわらか銀行のように1兆稼げるなら禿げてもいいんだけど)
で、1日ググってると
--rsh="ssh -l root"
を
-e "ssh -l root"
したりすればいいとあったりするが
解決できず禿げるのいやなので不貞寝。
次の日もググったらstackoverflowのこの記事が出てきた。
(前日は出てこなかったのにな。。)
http://stackoverflow.com/questions/7261029/how-to-solve-rsync-error-error-in-rsync-protocol-data-stream-code-12-at-io-c
ssh.exeの場所が見つからないんじゃねーの?ってことと解釈して
--rsh="./ssh -l root"
としたところ一発解決!
つーか、それってpathがしっかりしてないだけじゃ、、
ってことでpathを確認したら間違ってた。。
悩んで禿げそうな方、大変だろうが細部を確認してみて!
androidでのキーイベントを発行
アプリでキーボード叩きたいですか?
Yeah!
通常キーの発行の仕方
KeyEvent event = new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_0); dispatchKeyEvent(event);
普通にやればいい
アルファベット大文字の発行の仕方
long eventTime = SystemClock.uptimeMillis(); KeyEvent event1 = new KeyEvent( eventTime, eventTime, KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_A, 1, 65 ); dispatchKeyEvent(event1);
KeyEventの6つの引数をもったものを利用する
65はたぶん
META_SHIFT_LEFT_ON
META_SHIFT_ON
の値だと思われる
CTRLなどのキーはMETA系って言うんだと思うし
META系はKeyEvent6つ引数版でやる様子。
enterの発行の仕方
KeyEvent event1 = new KeyEvent( eventTime, eventTime, KeyEvent.ACTION_MULTIPLE , KeyEvent.KEYCODE_ENTER, 1, 0 ); dispatchKeyEvent(event1);
これが一番難儀だった。
@Override dispatchKeyEventで待ち構えていても
なぜかEnterは捉えることが出来ず諦めかけてたが
ググりまくってたらenterの発行ではなかったが
KeyEvent.ACTION_MULTIPLEを利用するコードが有り
もしかしてと試したらビンゴだった・・
(これが出来たときは相当雄叫び上げたと思うw)
KeyEvent.ACTION_MULTIPLEは未だに意味がわからないが
まあ、特殊な動作なんだろうなー
ってことで、発行したいキーによって作法がいろいろあるので、
条件分岐で対応ってことになるかと思う。
ちなみにadb経由でもキーイベントは発生できて
adb shell input keyevent 29
とすると「a」が送れます。
これを応用すると
Runtime.getRuntime().exec("input keyevent 29");
って具合にプログラムからでもキーが送れます
たぶんここに辿り着いた人は
何かしらの外部機器からの入力で
キーボードエミュレーションしたいんだと思う。
自分はそうだったわけだけど
で、思いついたのは
・1:ソフトウエアキーボードの開発をする
・2:simejiプラグイン(マッシュルーム)を書く
・3:Servicesで裏からキーを操作する
・4:専用アプリ上で仕方なく操作
だった。
1は明らかに自身のスペックでは無理、断念
2はどうも入力された文字をsimejiからプラグインに渡して「文字置換」をするっていうことだったので
リアルタイムな入力は無理そうだった。
3は試したところなんとかいけそうな気配だったが
Manifest android.permission.INJECT_EVENTSがセキュリティに引っかかり
にっちもさっちもいかない状況・・
Rootとれば出来るんだろうけど、なんともやるせない・・
結局一周回って4におちつくという、骨折り損のくたびれ儲け
ちかれた・・
参考になったらはてなスターでもつけといてくださいw
twitter api 1.1
twitterbotがいつの間にかつぶやかなくなってたw
調べてみたらとうの昔にapiが1.0から1.1にVerUpしてたのねw
ログにも
The Twitter REST API v1 is no longer active. Please migrate to API v1.1.
って・・・
自分はphpmのOAuth fetchでつぶやいていたので
URLを
http://api.twitter.com/1/statuses/update.xml
から
http://api.twitter.com/1.1/statuses/update.json
に書き換えることで対応完了でした
OAuthすげーw
$consumer_key = 'xxxx'; $consumer_secret = 'xxxx'; $oauthnmb = new OAuth($consumer_key,$consumer_secret,OAUTH_SIG_METHOD_HMACSHA1,OAUTH_AUTH_TYPE_URI); $oauth_token ="xxxx-xxxx"; $oauth_token_secret ="xxxxxx"; $tweet="あいうえお"; $params = array( 'status' => $tweet ); $oauth->setToken($oauth_token,$oauth_token_secret); //$oauth->fetch('http://api.twitter.com/1/statuses/update.xml', $params, OAUTH_HTTP_METHOD_POST ); $oauth->fetch('http://api.twitter.com/1.1/statuses/update.json', $params, OAUTH_HTTP_METHOD_POST );
初めてのBrew
Brewってwap端末の開発環境って思ってる人は結構なツウなひとで
今はmacのインストーラのことだそうです
CentOSのyumみたいなもんですね
初めて入れてみましたが簡単でした
っていうかbrewの公式ページ1枚目に書いてありますんで
こんな記事必要はないですw
$ brew install wget -bash: brew: command not found
もちろん無いですw
インストールをキメます
$ ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go)" ==> This script will install: /usr/local/bin/brew /usr/local/Library/... /usr/local/share/man/man1/brew.1 ==> The following directories will be made group writable: /usr/local/. /usr/local/bin ==> The following directories will have their group set to admin: /usr/local/. /usr/local/bin Press ENTER to continue or any other key to abort ==> /usr/bin/sudo /bin/chmod g+rwx /usr/local/. /usr/local/bin Password: ==> /usr/bin/sudo /usr/bin/chgrp admin /usr/local/. /usr/local/bin ==> Downloading and Installing Homebrew... remote: Counting objects: 123794, done. remote: Compressing objects: 100% (60882/60882), done. remote: Total 123794 (delta 87042), reused 96047 (delta 61928) Receiving objects: 100% (123794/123794), 19.56 MiB | 255 KiB/s, done. Resolving deltas: 100% (87042/87042), done. From https://github.com/mxcl/homebrew * [new branch] master -> origin/master HEAD is now at e35547d jenkins 1.527 ==> Installation successful! You should run `brew doctor' *before* you install anything. Now type: brew help
wgetは無いのを確認して・・
$ wget -bash: wget: command not found
$ brew install wget Warning: It appears you have MacPorts or Fink installed. Software installed with other package managers causes known problems for Homebrew. If a formula fails to build, uninstall MacPorts/Fink and try again. ==> Downloading http://ftpmirror.gnu.org/wget/wget-1.14.tar.gz ######################################################################## 100.0% ==> ./configure --prefix=/usr/local/Cellar/wget/1.14 --sysconfdir=/usr/local/etc ==> make install 🍺 /usr/local/Cellar/wget/1.14: 8 files, 708K, built in 85 seconds
ソースをDLしてインストールするのね
で、wgetは入りました
$ wget wget: missing URL Usage: wget [OPTION]... [URL]... Try `wget --help' for more options.
Rasberry piでfelica(edy/suica)を読む
Rasberry PIでfelicaのIDmを読みたくてウズウズしてたので
「やってみました」historyログをうpしておきます。
意外と簡単に行きましたが
libnfcが手持ちのRC-S320(白PaSeRi)ではどうにも認識ができませんでしたが、
libpafeとちょっとしたPGで対応できました。
以下は非常に参考になりました
Raspberry Pi で Sony の PaSoRi (RC-S330) を動かす
http://kludgelet.blogspot.jp/2012/08/raspberry-pi-sony-pasori-rc-s330_12.html
libpafeで行き先表示板
http://www.ei.fukui-nct.ac.jp/~t-saitoh/mt/2012/07/libpafe.html
libusb libpcscliteをインストール
cd /usr/local/src wget http://sourceforge.net/projects/libusb/files/libusb-1.0/libusb-1.0.9/libusb-1.0.9.tar.bz2 bzip2 -dc libusb-1.0.9.tar.bz2 |tar xvf - cd libusb-1.0.9 ./configure make make install
wget http://ftp.nara.wide.ad.jp/debian/pool/main/p/pcsc-lite/libpcsclite1_1.8.4-1+deb7u1_armhf.deb dpkg -i libpcsclite1_1.8.4-1+deb7u1_armhf.deb
apt-get install libusb-dev apt-get install libpcsclite-dev
# lsusb Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 001 Device 002: ID 0424:9512 Standard Microsystems Corp. Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp. Bus 001 Device 016: ID 1a40:0101 Terminus Technology Inc. 4-Port HUB Bus 001 Device 017: ID 1bcf:0007 Sunplus Innovation Technology Inc. Optical Mouse Bus 001 Device 018: ID 054c:005d Sony Corp. Bus 001 Device 019: ID 054c:005c Sony Corp. Bus 001 Device 008: ID 054c:01bb Sony Corp. FeliCa S320 [PaSoRi]
libnfcインストール
RC-S320では動きませんでした
wget http://libnfc.googlecode.com/files/libnfc-1.7.0-rc7.tar.gz tar xzvf libnfc-1.7.0-rc7.tar.gz cd libnfc-1.7.0-rc7 ./configure make make install
libpafeインストール
wget http://homepage3.nifty.com/slokar/pasori/libpafe-0.0.8.tar.gz tar xzvf libpafe-0.0.8.tar.gz cd libpafe-0.0.8/ ./configure make make install cat /etc/ld.so.conf.d/local.conf echo /usr/local/lib > /etc/ld.so.conf.d/local.conf ldconfig -v vi /lib/udev/rules.d/60-libpafe.rules -------------------------- ACTION!="add", GOTO="pasori_rules_end" SUBSYSTEM=="usb_device", GOTO="pasori_rules_start" SUBSYSTEM!="usb", GOTO="pasori_rules_end" LABEL="pasori_rules_start" ATTRS{idVendor}=="054c", ATTRS{idProduct}=="006c", MODE="0664", GROUP="plugdev" ATTRS{idVendor}=="054c", ATTRS{idProduct}=="01bb", MODE="0664", GROUP="plugdev" ATTRS{idVendor}=="054c", ATTRS{idProduct}=="02e1", MODE="0664", GROUP="plugdev" LABEL="pasori_rules_end" -------------------------- udevadm control --reload-rules # pasori_test PaSoRi (RC-S320) firmware version 1.40 Echo test... success EPROM test... success RAM test... success CPU test... success Polling test... success
IDm読みこみPG
libpafeで行き先表示板
http://www.ei.fukui-nct.ac.jp/~t-saitoh/mt/2012/07/libpafe.html
コンパイル方法
gcc -c felica.cxx ar r felica.a felica.o ranlib felica.a gcc -lpthread -lrt -o felica felica.o felica.a /usr/local/lib/libpafe.a /usr/local/lib/libusb-1.0.a
# ./felica
DB2 10.1のインストール
久しぶりに仮想環境でDB2をインストールしてみました。
OSはvagrantでささっと作ってしまいます。
OS作成作業が何かと面倒でしたが、vagrantで本当に楽にできてしまいます。
作業はMac OSX 10.8
VirtualBoxとはインストール済み、
vagrantはhttp://www.vagrantup.com/からdmgでインストール、
あとはコマンドラインでバシバシ打つのみ。
vagrantでcentosを拾ってくるw
$ vagrant box add centos64x64db2 http://developer.nrel.gov/downloads/vagrant-boxes/CentOS-6.4-x86_64-v20130427.box Downloading or copying the box... Extracting box...te: 458k/s, Estimated time remaining: --:--:--) Successfully added box 'centos64x64db2' with provider 'virtualbox'!
Vagrantfileファイルを作る
$ mkdir centos64x64db2 $ cd centos64x64db2 $ vagrant init centos64x64db2 A `Vagrantfile` has been placed in this directory. You are now ready to `vagrant up` your first virtual environment! Please read the comments in the Vagrantfile as well as documentation on `vagrantup.com` for more information on using Vagrant. $ ll total 16 drwxr-xr-x 3 staff 102 6 4 18:29 . drwxr-xr-x+ 44 staff 1496 6 4 18:29 .. -rw-r--r-- 1 staff 4359 6 4 18:29 Vagrantfile
Vagrantfile設定を変更
$ vi Vagrantfile config.vm.box = "centos64x64db2" config.vm.hostname = "centos64x64db2" config.vm.network :private_network, ip: "192.168.56.70" config.vm.provider :virtualbox do |vb| vb.name = "centos64x64db2" vb.gui = true vb.customize ["modifyvm", :id, "--memory", "1024"] end
centosを立ち上げる
$ vagrant up Bringing machine 'default' up with 'virtualbox' provider... [default] Importing base box 'centos64x64db2'... [default] Matching MAC address for NAT networking... [default] Setting the name of the VM... [default] Clearing any previously set forwarded ports... [default] Creating shared folders metadata... [default] Clearing any previously set network interfaces... [default] Preparing network interfaces based on configuration... [default] Forwarding ports... [default] -- 22 => 2222 (adapter 1) [default] Running any VM customizations... [default] Booting VM... [default] Waiting for VM to boot. This can take a few minutes. [default] VM booted and ready for use! [default] Setting hostname... [default] Configuring and enabling network interfaces... [default] Mounting shared folders... [default] -- /vagrant
DB2はexpress-c10.1 liteってやつを選んでます
ダウンロードは
http://www-06.ibm.com/software/jp/data/db2/express-c/
からログインして、
DB2 Express-C for Linux x86-64を選んで
「You can also download the files using http. 」で
ダウンロードURLを見つけましょう。
多分、以下のWGETへのURLでは有効期限もLicense的にもアウトでしょうw
# wget 'https://www6.software.ibm.com/sdfdl/v2/regs2/db2pmopn/db2_v101/expc/Xa.2/Xb.aA_60_-ilKzNqs0mX1lZneAK8oYUwfRmbHOAFpkc5A/Xc.db2_v101/expc/ db2_v1012_linuxx64_expc_lite.tar.gz/Xd./Xf.LPr.D1vk/Xg.7062336/Xi.swg-db2expressc/XY.regsrvs/XZ.O_k6_yqIoQjdQQpa43cC6SnKSIc/db2_v1012_linuxx64_expc_lite.tar.gz' --2013-06-04 09:37:24-- https://www6.software.ibm.com/sdfdl/v2/regs2/db2pmopn/db2_v101/expc/Xa.2/Xb.aA_60_-ilKzNqs0mX1lZneAK8oYUwfRmbHOAFpkc5A/Xc.db2_v101/expc/ db2_v1012_linuxx64_expc_lite.tar.gz/Xd./Xf.LPr.D1vk/Xg.7062336/Xi.swg-db2expressc/XY.regsrvs/XZ.O_k6_yqIoQjdQQpa43cC6SnKSIc/db2_v1012_linuxx64_expc_lite.tar.gz www6.software.ibm.com をDNSに問いあわせています... 170.225.15.41 www6.software.ibm.com|170.225.15.41|:443 に接続しています... 接続しました。 HTTP による接続要求を送信しました、応答を待っています... 200 OK 長さ: 472841425 (451M) [application/octet-stream] `db2_v1012_linuxx64_expc_lite.tar.gz' に保存中 100%[===================================================>] 472,841,425 126K/s 時間 28m 30s 2013-06-04 10:06:00 (270 KB/s) - `db2_v1012_linuxx64_expc_lite.tar.gz' へ保存完了 [472841425/472841425] # ll total 461764 -rw-r--r-- 1 root root 472841425 Dec 4 03:12 db2_v1012_linuxx64_expc_lite.tar.gz # tar xzvf db2_v1012_linuxx64_expc_lite.tar.gz # ll total 461768 -rw-r--r-- 1 root root 472841425 Dec 4 03:12 db2_v1012_linuxx64_expc_lite.tar.gz drwxr-xr-x 3 root root 4096 Jun 4 10:06 devinst # cd devinst/db2_v101fp2/linuxamd64/s121127/expc_lite/ # ll total 56 drwxr-xr-x 6 bin bin 4096 Nov 29 2012 db2 -r-xr-xr-x 1 bin bin 5349 Nov 29 2012 db2ckupgrade -r-xr-xr-x 1 bin bin 5302 Nov 29 2012 db2_deinstall -r-xr-xr-x 1 bin bin 5172 Nov 29 2012 db2_install -r-xr-xr-x 1 bin bin 5136 Nov 29 2012 db2ls -r-xr-xr-x 1 bin bin 5154 Nov 29 2012 db2prereqcheck -r-xr-xr-x 1 bin bin 5154 Nov 29 2012 db2setup drwxr-xr-x 28 bin bin 4096 Nov 29 2012 doc # ./db2_install Requirement not matched for DB2 database "Server" "". Version: "10.1.0.2". Summary of prerequisites that are not met on the current system: DBT3514W The db2prereqcheck utility failed to find the following 32-bit library file: "/lib/libpam.so*". DBI1324W Support of the db2_install command is deprecated. For more information, see the DB2 Information Center. Default directory for installation of products - /opt/ibm/db2/V10.1 *********************************************************** Install into default directory (/opt/ibm/db2/V10.1) ? [yes/no] yes <<==YES[enter]と入力 ….. The execution completed successfully. For more information see the DB2 installation log at "/tmp/db2_install.log.2274". # groupadd -g 510 db2grp1 # useradd -u 510 db2inst1 -g db2grp1 # passwd db2inst1 # groupadd -g 511 db2fgrp1 # useradd -u 511 db2fenc1 -g db2fgrp1 # passwd db2fenc1 # /opt/ibm/db2/V10.1/instance/db2icrt -u db2fenc1 db2inst1 DBI1446I The db2icrt command is running. ... The execution completed successfully. For more information see the DB2 installation log at "/tmp/db2icrt.log.23708". Required: Review the following log file also for warnings or errors: "/tmp/db2icrt_local.log.*" DBI1070I Program db2icrt completed successfully. # groupadd -g 512 db2asgrp # useradd -u 512 -g db2asgrp -G db2asgrp -d /home/db2as db2as # passwd db2as # /opt/ibm/db2/V10.1/instance/dascrt -u db2as DBI1070I Program dascrt completed successfully. # /opt/ibm/db2/V10.1/cfg/db2ln # vi /etc/services ------------------ #lrs-paging 3700/tcp # LRS NetPage #commplex-link 5001/tcp # # DB2 services db2c_DB2 3700/tcp db2i_DB2 5001/tcp ------------------ # /opt/ibm/db2/V10.1/instance/db2icrt -a SERVER -u db2fenc1 db2inst1 DBI1446I The db2icrt command is running. DB2 installation is being initialized. The instance "db2inst1" already exists. Specify a new instance name. A major error occurred during the execution that caused this program to terminate prematurely. If the problem persists, contact your technical service representative. For more information see the DB2 installation log at "/tmp/db2icrt.log.918". DBI1264E Errors were encountered in running db2icrt. Please refer to the installation log file /tmp/db2icrt.log.918 for more information. Explanation: All processed and failed operations have been saved into this log file. User response: Do not modify this file in any way. This file is for IBM Technical Support reference.
DB2起動&DB作成等々
# su - db2inst1 $ db2 update database manager configuration using svcename db2c_DB2 DB20000I The UPDATE DATABASE MANAGER CONFIGURATION command completed successfully. $ db2 get database manager configuration |grep -i svcename TCP/IP Service name (SVCENAME) = db2c_DB2 SSL service name (SSL_SVCENAME) = $ db2set DB2COMM=tcpip $ db2set DB2DAS00 DB2COMM=tcpip $ db2set DB2_COMPATIBILITY_VECTOR=3F $ db2start SQL1063N DB2START processing was successful. $ db2 list db directory SQL1031N The database directory cannot be found on the indicated file system. SQLSTATE=58031 $ db2 create database testdb DB20000I The CREATE DATABASE command completed successfully. $ db2 list db directory System Database Directory Number of entries in the directory = 1 Database 1 entry: Database alias = TESTDB Database name = TESTDB Local database directory = /home/db2inst1 Database release level = f.00 Comment = Directory entry type = Indirect Catalog database partition number = 0 Alternate server hostname = Alternate server port number = $ db2 connect to testdb Database Connection Information Database server = DB2/LINUXX8664 10.1.2 SQL authorization ID = DB2INST1 Local database alias = TESTDB $ db2 terminate DB20000I The TERMINATE command completed successfully.
pidora apache httpdが外部から見えない件
Rasberry pi に pidoraを入れてapache httpdも入れてみたが
どうにも外から繋がらない
fedoraは使ったことなかったので意味わからず
iptablesやSELinuxをOFFっても外から見えない
psでみてみると
root 129 15.6 2.7 23200 12228 ? Ss 03:47 0:05 /usr/bin/python /usr/sbin/firewalld --nofork
ってなのがあるので、調べてみると
これがFirewallらしい
# systemctl status firewalld.service firewalld.service - firewalld - dynamic firewall daemon Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled) Active: active (running) since Sat, 2013-05-18 03:47:58 JST; 2min 24s ago Main PID: 129 (firewalld) CGroup: name=systemd:/system/firewalld.service └ 129 /usr/bin/python /usr/sbin/firewalld --nofork May 18 03:47:58 raspi.local systemd[1]: Started firewalld - dynamic firewall daemon.
調査したら以下のようにして止めれば行けそう
ついでにiptablesもきちんと止める
systemctl disable iptables.service systemctl stop iptables.service systemctl disable firewalld.service systemctl stop firewalld.service
# systemctl status iptables.service iptables.service - IPv4 firewall with iptables Loaded: loaded (/usr/lib/systemd/system/iptables.service; disabled) Active: inactive (dead) CGroup: name=systemd:/system/iptables.service # systemctl status firewalld.service firewalld.service - firewalld - dynamic firewall daemon Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled) Active: inactive (dead) CGroup: name=systemd:/system/firewalld.service
これで外からport80が見えるようになったし、
rebootしてもport80が遮断されることもないので
これでいいんだと思う。
ちなみにXが自動で立ち上がるのをやめるには
「inittabのrunlevelを変える」
って思えていたが
昨今は
rm /etc/systemd/system/default.target ln -s /lib/systemd/system/multi-user.target /etc/systemd/system/default.target
とtargetファイルを変えるんだとか
(ってinittabに書いてあった)
いろいろ変わってるね