wgetでhttpsを使ってファイルを取得
以下を参考にして証明書無視してwgetでhttps経由でダウンロードできた。
というのはwordpressのモノは以前はhttpでダウンロードできていたのに、4.3になってからhttpでダウンロードしようとするとhttpsにフォワードしてくれてエラーとなるようだ。
$ wget http://ja.wordpress.org/wordpress-4.3-ja.zip --2015-08-30 09:38:36-- http://ja.wordpress.org/wordpress-4.3-ja.zip Resolving ja.wordpress.org... 66.155.40.250, 66.155.40.249 Connecting to ja.wordpress.org|66.155.40.250|:80... connected. HTTP request sent, awaiting response... 301 Moved Permanently Location: https://ja.wordpress.org/wordpress-4.3-ja.zip [following] --2015-08-30 09:38:37-- https://ja.wordpress.org/wordpress-4.3-ja.zip Connecting to ja.wordpress.org|66.155.40.250|:443... connected. ERROR: The certificate of ‘ja.wordpress.org’ is not trusted. ERROR: The certificate of ‘ja.wordpress.org’ hasn't got a known issuer. $ wget --no-check-certificate https://ja.wordpress.org/wordpress-4.3-ja.zip --2015-08-30 09:39:44-- https://ja.wordpress.org/wordpress-4.3-ja.zip Resolving ja.wordpress.org... 66.155.40.250, 66.155.40.249 Connecting to ja.wordpress.org|66.155.40.250|:443... connected. WARNING: The certificate of ‘ja.wordpress.org’ is not trusted. WARNING: The certificate of ‘ja.wordpress.org’ hasn't got a known issuer. HTTP request sent, awaiting response... 200 OK Length: 7579949 (7.2M) [application/zip] Saving to: ‘wordpress-4.3-ja.zip’ wordpress-4.3-ja.zi 100%[=====================>] 7.23M 368KB/s in 24s 2015-08-30 09:40:09 (313 KB/s) - ‘wordpress-4.3-ja.zip’ saved [7579949/7579949] $ md5sum wordpress-4.3-ja.zip 83c8eb427c21f30aaab1cba73f0d98d9 wordpress-4.3-ja.zip $
証明書確認なしなので、一応md5を確認して完了とした。
VMware FusionのWindows上で任意のファイル・フォルダを複数選択するには
Windows上での任意複数選択(CTRL+クリック)がMacOS XのVMware Fusion上ではできない件。Shift+クリックでまとめて選択はできるけど、任意のファイルを複数選択ってことはできないので意外に不便。これは以下のようにして変更できる。
1. プロファイルを確認
[仮想マシン]->[設定]から[キーボードとマウス]を選択。
使用しているプロファイルを確認する。
2. 環境設定を変更
[VMware Fusion]->[環境設定]を選択し、[キーボードとマウス]を選択する。[キーボードとマウスのプロファイル]で確認したプロファイルに設定し、[副ボタン]のチェックをはずす。
使っているマシンは右クリックが付いているのでいいんだけれどApple純正のマウスやトラックパッドのときは却って右クリックがないので不便かもしれない。
参照サイトは以下
http://www.softantenna.com/wp/mac/ctrl-select-windows-on-vmware-fusion/
HTMLでの外部リソース指定にプロトコルがいらない件
以下の記事を見て省略できるってことを知り驚いた。
http://detarame.moo.jp/2012/08/07/google%E3%81%8C%E6%8E%A8%E8%96%A6%E3%81%99%E3%82%8Bhtml%E3%81%A8css%E3%81%AE%E3%82%B3%E3%83%BC%E3%83%87%E3%82%A3%E3%83%B3%E3%82%B0%E6%96%B9%E6%B3%95/
http://google-styleguide.googlecode.com/svn/trunk/htmlcssguide.xml
Google HTML/CSS Style Guideの[Protocol]の[Omit the protocol from embedded resources.]の箇所。
<!-- Not recommended --> <script src="http://www.google.com/js/gweb/analytics/autotrack.js"></script>
<!-- Recommended --> <script src="//www.google.com/js/gweb/analytics/autotrack.js"></script>
/* Not recommended */ .example { background: url(http://www.google.com/images/example); }
/* Recommended */ .example { background: url(//www.google.com/images/example); }
マジか。httpからhttpsへの変更、またはその逆で以前修正していたことを思い出しちょっと悲しくなった。
上記リンクではその他にも有能なtipsが載っている。
VMware Fustion7上のCentOS6.5にVMware Toolsを再インストール
VMware FusionをアップグレードしてからCentOSを起動していなかったのでVMware Toolsを再インストールしていなかった。そのため、ホストOSとゲストOS間でのコピペがうまくいかない(これが一番痛い)ので再インストールを実施。
1. メニューの[仮想マシン]の[VMware Toolsの再インストール]を選択。
2. ダイアログがでてくるので[インストール]をクリック。
3. メニューの[仮想マシン]では[VMware Toolsのインストールをキャンセル]となっている。
4. /media/VMware Toolsにマウントされるので、あとは解凍して実行する。質問はすべてデフォルト。
$ df Filesystem 1K-blocks Used Available Use% Mounted on /dev/mapper/VolGroup-lv_root 18134344 6798704 10414452 40% / tmpfs 953272 232 953040 1% /dev/shm /dev/sda1 495844 126912 343332 27% /boot /dev/sr0 62490 62490 0 100% /media/VMware Tools $ pwd /media/VMware Tools $ ls -l 合計 62139 -r--r--r-- 1 kohchi kohchi 62183192 5月 23 06:44 2015 VMwareTools-9.9.3-2759765.tar.gz -r-xr-xr-x 1 kohchi kohchi 1959 5月 23 06:43 2015 manifest.txt -r--r--r-- 1 kohchi kohchi 1850 5月 23 06:41 2015 run_upgrader.sh -r-xr-xr-x 1 kohchi kohchi 683620 5月 23 06:42 2015 vmware-tools-upgrader-32 -r-xr-xr-x 1 kohchi kohchi 758168 5月 23 06:42 2015 vmware-tools-upgrader-64 $ cp -ip VMwareTools-9.9.3-2759765.tar.gz /tmp $ cd /tmp $ zcat VMwareTools-9.9.3-2759765.tar.gz | tar xvf - 解凍したファイルが表示 .... $ cd vmware-tools-distrib/ $ su # ./vmware-install.pl A previous installation of VMware Tools has been detected. The previous installation was made by the tar installer (version 4). Keeping the tar4 installer database format. You have a version of VMware Tools installed. Continuing this install will first uninstall the currently installed version. Do you wish to continue? (yes/no) [yes] Uninstalling the tar installation of VMware Tools. Stopping services for VMware Tools Stopping VMware Tools services in the virtual machine: Guest operating system daemon: [ OK ] VMware User Agent (vmware-user): [ OK ] Blocking file system: [ OK ] Unmounting HGFS shares: [ OK ] Guest filesystem driver: [ OK ] VM communication interface socket family: [ OK ] VM communication interface: [ OK ] Stopping Thinprint services in the virtual machine: Stopping Virtual Printing daemon: done File /etc/pulse/default.pa is backed up to /etc/pulse/default.pa.old.5. The removal of VMware Tools 9.9.3 build-2759765 for Linux completed successfully. Installing VMware Tools. In which directory do you want to install the binary files? [/usr/bin] What is the directory that contains the init directories (rc0.d/ to rc6.d/)? [/etc/rc.d] What is the directory that contains the init scripts? [/etc/rc.d/init.d] In which directory do you want to install the daemon files? [/usr/sbin] In which directory do you want to install the library files? [/usr/lib/vmware-tools] In which directory do you want to install the documentation files? [/usr/share/doc/vmware-tools] The path "/usr/share/doc/vmware-tools" does not exist currently. This program is going to create it, including needed parent directories. Is this what you want? [yes] The installation of VMware Tools 9.9.3 build-2759765 for Linux completed successfully. You can decide to remove this software from your system at any time by invoking the following command: "/usr/bin/vmware-uninstall-tools.pl". Before running VMware Tools for the first time, you need to configure it by invoking the following command: "/usr/bin/vmware-config-tools.pl". Do you want this program to invoke the command for you now? [yes] Initializing... Making sure services for VMware Tools are stopped. Stopping Thinprint services in the virtual machine: Stopping Virtual Printing daemon: done Stopping VMware Tools services in the virtual machine: Guest operating system daemon: [ OK ] VMware User Agent (vmware-user): [ OK ] Blocking file system: [ OK ] Unmounting HGFS shares: [ OK ] Guest filesystem driver: [ OK ] VM communication interface socket family: [ OK ] VM communication interface: [ OK ] Found a compatible pre-built module for vmci. Installing it... Found a compatible pre-built module for vsock. Installing it... The module vmxnet3 has already been installed on this system by another installer or package and will not be modified by this installer. The module pvscsi has already been installed on this system by another installer or package and will not be modified by this installer. The module vmmemctl has already been installed on this system by another installer or package and will not be modified by this installer. The VMware Host-Guest Filesystem allows for shared folders between the host OS and the guest OS in a Fusion or Workstation virtual environment. Do you wish to enable this feature? [yes] Found a compatible pre-built module for vmhgfs. Installing it... Found a compatible pre-built module for vmxnet. Installing it... The vmblock enables dragging or copying files between host and guest in a Fusion or Workstation virtual environment. Do you wish to enable this feature? [yes] VMware automatic kernel modules enables automatic building and installation of VMware kernel modules at boot that are not already present. This feature can be enabled/disabled by re-running vmware-config-tools.pl. Would you like to enable VMware automatic kernel modules? [no] Thinprint provides driver-free printing. Do you wish to enable this feature? [yes] Disabling timer-based audio scheduling in pulseaudio. Do you want to enable Guest Authentication (vgauth)? [yes] Detected X server version 1.13.0 Distribution provided drivers for Xorg X server are used. Skipping X configuration because X drivers are not included. Creating a new initrd boot image for the kernel. Starting Virtual Printing daemon: done Checking acpi hot plug [ OK ] Starting VMware Tools services in the virtual machine: Switching to guest configuration: [ OK ] VM communication interface: [ OK ] VM communication interface socket family: [ OK ] Guest filesystem driver: [ OK ] Mounting HGFS shares: [失敗] Blocking file system: [ OK ] VMware User Agent: [ OK ] Guest operating system daemon: [ OK ] The configuration of VMware Tools 9.9.3 build-2759765 for Linux for this running kernel completed successfully. You must restart your X session before any mouse or graphics changes take effect. You can now run VMware Tools by invoking "/usr/bin/vmware-toolbox-cmd" from the command line. To enable advanced X features (e.g., guest resolution fit, drag and drop, and file and text copy/paste), you will need to do one (or more) of the following: 1. Manually start /usr/bin/vmware-user 2. Log out and log back into your desktop session; and, 3. Restart your X session. Enjoy, --the VMware team # df Filesystem 1K-blocks Used Available Use% Mounted on /dev/mapper/VolGroup-lv_root 18134344 7047724 10165432 41% / tmpfs 953272 232 953040 1% /dev/shm /dev/sda1 495844 126913 343331 27% /boot #
HGFSが失敗しているけど元々エラーだったのでとりあえず終了。
元記事は以下。
http://mawatari.jp/archives/centos-6-2-vmware-tools-install-log
gdbでgetopt()のoptind/optoptを参照したときに値が違うように見える
結構ハマったのでメモ。
#include <stdio.h> #include <getopt.h> char *short_opts = "ab:"; struct option long_opts[] = { {"test", no_argument, 0, 0}, {"add", required_argument, 0, 0}, {0, 0, 0, 0} }; int main(int argc, char *argv[]) { int c = 0; int longindex; while (1) { longindex = 0; c = getopt_long(argc, argv, short_opts, long_opts, &longindex); if (c == -1) { break; } fprintf(stdout, "%d(%x) %d(%x) %c(%x)\n", c, &c, optind, &optind, optopt, &optopt); } return 0; }
というソースがあり、getoptのextern変数optind, optoptの実際の値とgdbで参照した値が違うのに気がついた。
$ cc -g getopt.c $ ./a.out -a -b a --test --add A 97(4cc7b7ac) 2(600ae4) (600ae0) 98(4cc7b7ac) 4(600ae4) (600ae0) 0(4cc7b7ac) 5(600ae4) (600ae0) 0(4cc7b7ac) 7(600ae4) (600ae0) $ gdb a.out GNU gdb (GDB) Red Hat Enterprise Linux (7.2-60.el6_4.1) Copyright (C) 2010 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "x86_64-redhat-linux-gnu". For bug reporting instructions, please see: <http://www.gnu.org/software/gdb/bugs/>... Reading symbols from /home/kohchi/C/a.out...done. (gdb) b main Breakpoint 1 at 0x4005e4: file getopt.c, line 14. (gdb) run -a -b a --test --add A Starting program: /home/kohchi/C/a.out -a -b a --test --add A Breakpoint 1, main (argc=7, argv=0x7fffffffe1c8) at getopt.c:14 14 int c = 0; Missing separate debuginfos, use: debuginfo-install glibc-2.12-1.132.el6_5.2.x86_64 (gdb) n 18 longindex = 0; (gdb) 19 c = getopt_long(argc, argv, short_opts, long_opts, &longindex); (gdb) 20 if (c == -1) { (gdb) 24 fprintf(stdout, "%d(%x) %d(%x) %c(%x)\n", (gdb) p c $1 = 97 (gdb) p optind $2 = 1 (gdb) p optopt $3 = 63 (gdb) n 97(ffffe0cc) 2(600ae4) (600ae0) ※あれ?optind=2 optopt=0になっている。 26 } (gdb)
で以下のページを参照したところ、シェアードライブラリの値と実行バイナリで使っているものが2つあるらしい。
コマンドを実行すると当然シェアードライブラリ中の値となるのだが、gdbで何も指定しないと実行バイナリのものを表示するらしい。
http://www.linuxquestions.org/questions/programming-9/gdb-does-not-print-right-value-908538/
なのでgdbでは以下のように"@@GLIBC_X.X.X"を指定するとシェアードライブラリの値を参照できるようだ。
$ gdb a.out GNU gdb (GDB) Red Hat Enterprise Linux (7.2-60.el6_4.1) Copyright (C) 2010 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "x86_64-redhat-linux-gnu". For bug reporting instructions, please see: <http://www.gnu.org/software/gdb/bugs/>... Reading symbols from /home/kohchi/C/a.out...done. (gdb) b main Breakpoint 1 at 0x4005e4: file getopt.c, line 14. (gdb) run -a -b a --test --add A Starting program: /home/kohchi/C/a.out -a -b a --test --add A Breakpoint 1, main (argc=7, argv=0x7fffffffe1c8) at getopt.c:14 14 int c = 0; Missing separate debuginfos, use: debuginfo-install glibc-2.12-1.132.el6_5.2.x86_64 (gdb) n 18 longindex = 0; (gdb) 19 c = getopt_long(argc, argv, short_opts, long_opts, &longindex); (gdb) 20 if (c == -1) { (gdb) p c $1 = 97 (gdb) p /c c $2 = 97 'a' (gdb) n 24 fprintf(stdout, "%d(%x) %d(%x) %c(%x)\n", (gdb) l 19 c = getopt_long(argc, argv, short_opts, long_opts, &longindex); 20 if (c == -1) { 21 break; 22 } 23 24 fprintf(stdout, "%d(%x) %d(%x) %c(%x)\n", 25 c, &c, optind, &optind, optopt, &optopt); 26 } 27 return 0; 28 } (gdb) n 97(ffffe0cc) 2(600ae4) (600ae0) 26 } (gdb) p optind $3 = 1 ※2になっていないぞ (gdb) p &optind $4 = (int *) 0x38bfd8e114 ※参照先も違う (gdb) p optopt $5 = 63 ※0になっていないぞ (gdb) p &optopt $6 = (int *) 0x38bfd8e11c ※参照先も違う (gdb) p optind[tabを2回押す] optind optind@@GLIBC_2.2.5 (gdb) p 'optind@@GLIBC_2.2.5' $7 = 2 ※OK! (gdb) p &'optind@@GLIBC_2.2.5' $8 = (<data variable, no debug info> *) 0x600ae4 ※OK! (gdb) p optopt[tabを2回押す] optopt optopt@@GLIBC_2.2.5 (gdb) p 'optopt@@GLIBC_2.2.5' $9 = 0 ※OK! (gdb) p &'optopt@@GLIBC_2.2.5' $10 = (<data variable, no debug info> *) 0x600ae0 ※OK! (gdb) info var optind All variables matching regular expression "optind": Non-debugging symbols: 0x0000000000600ae4 optind@@GLIBC_2.2.5 (gdb) info var optopt All variables matching regular expression "optopt": Non-debugging symbols: 0x0000000000600ae0 optopt@@GLIBC_2.2.5 (gdb) n 18 longindex = 0; (gdb) quit A debugging session is active. Inferior 1 [process 8020] will be killed. Quit anyway? (y or n) y $
MacPortsのselfupdateがエラーになる件(MacOS X 10.7.5 Lion)
MacPortsを久しぶりに動かそうとしたら古いって言われたのでupdateしようとした。がエラー。
$ sudo port install xz Password: Warning: port definitions are more than two weeks old, consider using selfupdate Error: Insufficient privileges to write to MacPorts install prefix. $ sudo port selfupdate Password: ---> Updating MacPorts base sources using rsync MacPorts base version 2.1.3 installed, MacPorts base version 2.3.3 downloaded. ---> Updating the ports tree ---> MacPorts base is outdated, installing new version 2.3.3 Installing new MacPorts release in /opt/local as root:admin; permissions 0755; Tcl-Package in /Library/Tcl Error: /opt/local/bin/port: port selfupdate failed: Error installing new MacPorts base: command execution failed $
こちらのサイトによると、Xcodeのコマンドラインツールが必要とのことで実行してみたが、--installなんてオプションがないのでインストールできない。
$ sudo xcode-select --install Usage: xcode-select -print-path or: xcode-select -switch <xcode_folder_path> or: xcode-select -version Arguments: -print-path Prints the path of the current Xcode folder -switch <xcode_folder_path> Sets the path for the current Xcode folder -version Prints xcode-select version information $ xcode-select -version xcode-select version 2308. $
どうもこのバージョンには--installなんてオプションがないらしい(OSが古いから?)。
Xcodeを起動し[Xcode] -> [Open Developer Tool] -> [More Developer Tools…] を開いてDeveloperネットワークに接続して
をダウンロード。ちなみにXcode自体は4.6.2になっている。なのでコマンドラインツールをインストールしてなかったということ。
ダウンロードしたファイル
xcode462_cltools_10_76938260a.dmg
をクリックしてマウントし、表示された
Command Line Tools(Lion).mpkg
を起動してインストールする。インストール画面に「インストールが完了しました。」が出たら終了。
その後、selfupdateしてみた。ちなみにxcode-selectがバージョンアップされるわけではない。
$ xcode-select -version xcode-select version 2308. $ sudo port selfupdate Password: ---> Updating MacPorts base sources using rsync MacPorts base version 2.1.3 installed, MacPorts base version 2.3.3 downloaded. ---> Updating the ports tree ---> MacPorts base is outdated, installing new version 2.3.3 Installing new MacPorts release in /opt/local as root:admin; permissions 0755; Tcl-Package in /Library/Tcl The ports tree has been updated. To upgrade your installed ports, you should run port upgrade outdated
メッセージのとおり、ついでに portでインストールしたものもupgradeを実行した。
$ sudo port upgrade outdated Password: …… $
でインストールしたかったxzなんだけど、upgradeしたら入っていたみたい。
$ which xz /opt/local/bin/xz $ ls -l /opt/local/bin/xz -rwxr-xr-x 1 root admin 75384 3 9 16:41 /opt/local/bin/xz $ which unxz /opt/local/bin/unxz $ ls -l /opt/local/bin/unxz lrwxr-xr-x 1 root admin 2 3 9 16:41 /opt/local/bin/unxz -> xz $
結局は、OSが古い(といってももうバージョンアップできないから仕方ない)のでMacPortsのアップデートに必要なXcodeコマンドラインツールをxcode-select --installでインストールできずにハマったというオチ。
参考サイトは以下。
http://t-horikiri.hatenablog.jp/entry/20131031/1383202003
http://little-braver.com/450/
MacOSXのarp-scan
以下のサイトで紹介されていたarp-scanをMacOSXにインストールして使ってみる。
MacOSXのパッケージはrudixってところで作ってくれている。rudix自体をインストールしておけばコマンドでもインストールできそう。今回は以下のページからインストールするOSのバージョンのpkgをダウンロードしてインストールした。
使い方
こんな感じ。
$ sudo arp-scan -I en1 -l Password: Interface: en1, datalink type: EN10MB (Ethernet) Starting arp-scan 1.8 with 256 hosts (http://www.nta-monitor.com/tools/arp-scan/) 192.168.10.1 XX:XX:XX:XX:XX:XX (Unknown)