2019年3月20日水曜日

GoutteでUserAgentの変更

symfony, goutteでuseragentを変更する

$client = new Client();
$client->setServerParameter('HTTP_USER_AGENT', 'Mozilla/5.0 Firefox/66.0');

参照:setServerParameter($key, $value)

2018年1月17日水曜日

Windows10 ネットワーク上のコンピューターが表示されない

コントロールパネルプログラムと機能
Windowsの機能の有効化または無効化

SMB 1.0/CIFS Automatic Removal

3種類あると思いますが、真ん中だけチェックがされていなくて全部チェックする設定にして再起動してみたら表示されなくなったパソコンが表示されるようになりました。確認してみる価値はあると思います。



ビンゴです。素晴らしい!
Windows 10  ネットワーク上のコンピューターが表示されない

2017年9月19日火曜日

python3.6.2にmysql-connectorのインストール

centos7にソースからビルドしたpython3.6.2を使用。
pip3 install mysql-connector エラーでインストールできない。
protobufが必要らしい。
それっぽいのを探してインストール。

$ yum search protobuf
$ sudo yum install protobuf protobuf-c protobuf-c-devel protobuc-c-compiler
$ pip3 install mysql-connector

まだ駄目。

Requirements
mysql-connector (version >= 2.2.3) requires Protobuf C++ (version >= 2.6.0)
らしい。README.md
centos7のprotobufは2.5.0

ソースからビルドする。

$ wget https://github.com/google/protobuf/releases/download/v3.4.1/protobuf-cpp-3.4.1.tar.gz
$ tar xvzf protobuf-cpp-3.4.1.tar.gz
$ cd protobuf-3.4.1
$ ./autogen.sh
$ ./configure
$ make
$ make check
$ sudo make install
$ sudo ldconfig
$ export MYSQLXPB_PROTOBUF_LIB_DIR=/usr/local/lib
$ export MYSQLXPB_PROTOC=/usr/local/bin/protoc
$ export MYSQLXPB_PROTOBUF_INCLUDE_DIR=/usr/local/include/google/protobuf
$ pip3 install mysql-connector
でインストールできた。

2017年8月21日月曜日

windows10 Home でRDPWrapper が動かなくなった

RDPConf.exe を実行すると Listener state が Not listening になる

解決策
zipファイルを解凍して rfxvmt.dll を C:\windows\system32 にコピーする。

2017年8月7日月曜日

iptables -L

Chain INPUT (policy DROP)
target     prot opt source               destination
DROP       all  --  43.224.249.212       anywhere                                         
DROP       all  --  182.48.0.0/18        anywhere
DROP       all  --  49.212.0.0/16        anywhere
DROP       all  --  59.106.0.0/16        anywhere
DROP       all  --  219.94.128.0/17      anywhere
DROP       all  --  24.4.0.0/15          anywhere
ACCEPT     all  --  anywhere             anywhere
ACCEPT     all  --  anywhere             anywhere            state RELATED,ESTABLISHED
LOG        all  -f  anywhere             anywhere            LOG level warning prefix `'[FRAGMENT]''
DROP       all  -f  anywhere             anywhere
ACCEPT     tcp  --  anywhere             anywhere            state NEW tcp dpt:http
ACCEPT     tcp  --  anywhere             anywhere            state NEW tcp dpt:https
ACCEPT     tcp  --  anywhere             anywhere            state NEW tcp dpt:55525
ACCEPT     tcp  --  anywhere             anywhere            state NEW tcp dpt:smtp
ACCEPT     icmp --  anywhere             anywhere
ACCEPT     udp  --  anywhere             anywhere            state NEW udp dpts:60000:61000

Chain FORWARD (policy DROP)
target     prot opt source               destination

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination

2017年5月14日日曜日

IO::Socket::SSL エラー "Bad address"

フレッツ光プレミアムからフレッツ光ネクストに変更してからか、windows updateしてからか、 Mail::IMAPClient でgmailに接続できなくなった。


my $socket = IO::Socket::SSL->new(
                                  PeerHost => 'imap.gmail.com',
                                  PeerPort => 993,
                                 ) or die "socket(): $@";

で "socket(): Bad address at ... line 31." のエラー。


use IO::Socket::SSL 'inet4';

で解決。

参考ページ
How to connect to a Gmail inbox
Perl IO::Socket::SSL: connect: Network is unreachable

2017年3月15日水曜日

pip install error: Unable to find vcvarsall.bat

 pip で "pip install error: Unable to find vcvarsall.bat" エラーが出てインストール出来ない



You will need
3.5 and later Visual C++ Build Tools 2015 or Visual Studio 2015
3.3 and 3.4 Windows SDK for Windows 7 and .NET 4.0
(Alternatively, Visual Studio 2010 if you have access to it)
2.6 to 3.2 Microsoft Visual C++ Compiler for Python 2.7


How to deal with the pain of “unable to find vcvarsall.bat” より

2016年1月14日木曜日

perl 先読み後読みパターンマッチ

 (?=パターン)  肯定の先読み  この先にパターンが出てくる場所にマッチ
 (?!パターン)  否定の先読み  この先にパターンが出てこない場所にマッチ
 (?<=パターン) 肯定の後読み  この前にパターンが出てきた場所にマッチ
 (?<!パターン) 否定の後読み  この前にパターンが出てこなかった場所にマッチ

2014年12月21日日曜日

~/.goaccessrcが反映されない


--no-global-config オプションを付けて実行する

goaccess --no-global-config -p access_log

cat `access_log-* 2>/dev/null` access_log | goaccess --no-global-config

config file に log_file を設定しているとパイプを通して実行できない。

https://github.com/allinurl/goaccess/issues/115

2014年8月26日火曜日

roxterm キーボードショートカットのカスタマイズ

Keyboard Shortcuts

There is no editor for keyboard shortcuts; instead they can be changed by pressing keys while the mouse is hovering over a menu item in the terminal, provided editable shortcuts are enabled in your desktop session. In GNOME you have to edit a "secret" option, either by running the command:

gconftool --type bool --set /desktop/gnome/interface/can_change_accels true

or by editing the /desktop/gnome/interface/can_change_accels option with gconf-editor ("Configuration Editor").




New Tab のショートカットをを Shift + Ctrl + T から Ctrl + F1 に変更したい。

メニューバーから変更したいコマンドをマウスで選択した状態で、新たに割り当てたいキーを押す。
この画像の状態で Ctrl + F1 を押す。




ショートカットが変更される。

 


2014年7月21日月曜日

ガーリックパウダー炎上

カーリックパウダーが湿気って瓶の中で固まった。
瓶を振ってみても、固まったパウダーを箸でつついても崩れそうな気配がない。
電子レンジにかけたら乾燥して崩れるんじゃないか。

瓶のまま20秒、箸で突くとガム状になったパウダーが瓶から剥がれた。
パウダー塊をラップを敷いた耐熱140℃ポリプロピレン製の小皿に載せ替えて再度レンジへ。

十数秒後ボンという音がする。電子レンジがやけに明るい。
レンジの中でメラメラと炎が揺れていた。
慌てて布巾をかぶせ、流しへ放り投げて蛇口をひねる。
部屋中に白煙が立ち込め、焼却炉のような臭いが充満する。

電子レンジではちょくちょく失敗をやらかす。
今回は久しぶりに焦った大チョンボでした。




2014年3月28日金曜日

rootパスワード設定済み mysql DBD::mysql インストール

cpanm DBD::mysql
rootにパスワード設定済みなのでエラー
DBI->connect(test) failed: Access denied for user: 'root@localhost' (Using password: NO)

perl Makefile.PL --testuser=myname --testpassword=mypasswd
make test
make install

2014年1月15日水曜日

Drop trendmicro.com

トレンドマイクロ嫌い

#iptables -A INPUT -p tcp --dport 80 -s 150.70.0.0/16 -j DROP

fedora20 grub2のデフォルト起動のOSをwindowsに変更

kernelアップデートの度にgrub2のエントリーメニューが変わる

#grub2-mkconfig 2> /dev/null | grep -i windows
menuentry 'Windows 8 (loader) (on /dev/sda1)' --class windows --classs os $menuentry_id_option 'osprober-chain-B0B4CF40B4CF3804' {

#grub2-set-default 'Windows 8 (loader) (on /dev/sda1)'

リブートすればデフォルト起動OSがWindowsになっている。
/boot/grub/grub.cfgの編集なしでいける。

2014年1月11日土曜日

Centos Awstats

URL => .../$ScriptAlias/awstats.pl?config=$SiteDomain

ScriptAlias => /etc/httpd/conf.d/awstats.conf
SiteDomain => /usr/share/awstats/

/etc/awstats/awstats.$SiteDomain.conf
=> AllowToUpdateStatsFromBrowser=1

chown -R apache
=> /var/lib/awstats/
=> /var/log/httpd/

2013年12月27日金曜日

ASUS U30S windows8.1 フリーズ再発

ASUS U30Sのフリーズが再発。
日に二回くらいの頻度で起こるようになった。
win7の時は全く問題がなかった。
win8にしてから多発するようになった。
8.1にアップグレードしてもやはり起こる。
グラフィックドライバーのアップデートで治ったかに見えたが...
何の前触れもなく、突然無反応になってしまう。
イベントビューアに記録される間もなく固まってしまう。
ドライバ関係だと思うがまったくお手上げ。

U30Sもwin8も気に入っているので非常に辛い。
ASUSUもU30Sはwin8はサポート対象外のようなのでしょうがないが。
vistaからwin8、win8.1にアップグレードしたサブ機のHP 6355sは何事もなく動作している。