Bookmarklet で煩わしいテストの手助けをする

Bookmarklet で煩わしいテストの手助けをする WEBでテストする際にたまに必要になるのが、100件クリックする、や入力項目全部に入力した状態で、 クリックするなど単純動作を繰り返す事。 単純作業である為、おそらく5回くらいクリックした時点で飽きてしまい、業務中に寝てしまう事になりそう。 以下のような Bookmarklet を準備しておけば、ちょっとした際に、さらっと js 書いて、100回でも、1000回でも クリックできます。 javascript:(function(f,urls,i,s){urls=["//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"/* ,"URL","URL",... */];for(i=0;i<urls.length;i++){s=document.createElement("script");s.src=urls[i];if(i==urls.length-1)s.onload=function(){f(jQuery.noConflict(true))};document.body.appendChild(s)}})(function($){/* 内部コード */}) 対象のページにできるだけ影響の無いように、かつ、CDNで jQury を持ってきて、後はやりたいことちょろっと書くだけ。しかもjQuery以外のライブラリもロードできる! 便利

2016-10-30 ·  2016-10-30 · 1 分 · 20 文字

ldapsearch コマンドで AD 情報を検索する

もう何がなんだかわからないので、とりあえずメモ。。 LDAP ワード集 DIT = Directory Information Tree DN = 識別名(Distinguished Name) DC = ドメイン構成要素(domain component) O = 組織名(organization) OU = 組織単位(organizational unit) CN = 一般名称(common name) sample.local ドメインの場合の検索方法 # ユーザ Administrator を検索 ldapsearch -x -LLL -D "cn=Administrator,cn=Users,dc=sample,dc=local" -W -b "cn=Administrator,cn=Users,dc=sample,dc=local" # CN Users に属するユーザを検索 ldapsearch -x -LLL -D "cn=Administrator,cn=Users,dc=sample,dc=local" -W -b "cn=Users,dc=sample,dc=local" 以下、 ldapsearch コマンドの OPTION 抜粋 ldapsearch opens a connection to an LDAP server, binds, and performs a search using specified parameters. The filter should conform to the string representation for search filters as defined in RFC 4515. If not provided, the default filter, (objectClass=*), is used. If ldapsearch finds one or more entries, the attributes specified by attrs are returned. If * is listed, all user attributes are returned. If + is listed, all operational attributes are returned. If no attrs are listed, all user attributes are returned. If only 1.1 is listed, no attributes will be returned. The search results are displayed using an extended version of LDIF. Option -L controls the format of the output. -L Search results are display in LDAP Data Interchange Format detailed in ldif(5). A single -L restricts the output to LDIFv1. A second -L disables comments. A third -L disables printing of the LDIF version. The default is to use an extended version of LDIF. -x use simple authentication (as opposed to SASL) -H <ldapuri> Used to specify a URI or list of URI’s to of ldap servers. This can also be used to specify the protocol, server, and port for queries using SSL/TLS, ie: -H "ldaps://myserver.mydomain.com:636". -h <ldaphost> specify host to query -p <port> specify port to connect to; 389 is the default (optional) -b <search base> The starting point for the search. It often looks like "dc=mydomain,dc=com" 「ベースDN」はLDAP検索のベース(基本)となるエントリを指定 -D <binddn> The DN to bind to the directory. In other words, the user you are authenticating with. The bind DN may look like “uid=myuser,dc=mydomain,dc=com” or “cn=Directory Manager”. The Directory Manager is the directory’s superuser account. -W Prompt for the password. The password should match what is in your directory for the the binddn (-D). Mutually exclusive from -w. -w <password> Specify your password on the command line. -s <scope> speicfy the scope as <base|one|sub|children>. Base searches just the base object, sub searches all subtrees, one searches one level, and children searches just child nodes. The default is sub. -z 0 Set the sizelimit for a search in the event the server enforces a limit that’s cutting off your results. Only the super user account (Directory Manager) can do this. -ZZ Force use of StartTLS. 難しい。。。 ...

2015-10-18 ·  2015-10-18 · 3 分 · 454 文字

Docker Machine(Boot2Docker(Tiny Linux)) 上で docker/gitlab を動かしてみる

sameersbn/gitlab:8.0.4 オンプレミスな GitHub Clone GitLab かなり気持ち悪いロゴ…(なぜこうなった) バージョンUPでこうなったらしい… それはいいとして、 Docker image を利用して、公式に公開されている、docker/gitlab を docker-machine で作成した docker-host(virtual-box) 上で 動かしてみた。 インストール ssh で docker-machine ホストOSへ接続した状態でおこなう docker-machine ssh dev docker pull sameersbn/gitlab:8.0.4 cd ~/works/ git clone https://github.com/sameersbn/docker-gitlab.git cd docker-gitlab # Dockerfile からビルドする場合 # docker build --tag=$USER/gitlab . docker-compose インストール docker コンテナを複数使用するアプリケーションの構成(起動順序や必要リソースなど)をまとめて管理できるのが、 docker-compose clone されたディレクトリに、 docker-compose.yml が存在するので、 docker-compose で起動できる。 # docker-compose ダウンロード cd ~/Downloads wget https://github.com/docker/compose/releases/download/1.4.2/docker-compose-Linux-x86_64 sudo mv docker-compose-Linux-x86_64 /usr/local/bin/docker-compose sudo chmod 755 /usr/local/bin/docker-compose # version 確認 docker-compose --version # 以下が表示される # docker-compose version: 1.4.2 GitLab 設定 以下コマンドで SEACRET_KEY を生成する ...

2015-10-10 ·  2015-10-10 · 2 分 · 329 文字

Ubuntu 14.04 上に Docker Machine を インストールする

Docker Machine を試す! docker-machine docker-machine は Docker ホストを管理するツールで、ホストとなる Docker コンテナ起動サーバが、VM や AWS、 Digital Ocean などの ホストへ接続し実行する事で、あたかも local で docker コンテナが動いているかのように振る舞うツール。 Docker コンテナ管理ツールとしても仕様できるみたい。 docker インストール まずは、 dokcer のインストール # Docker install wget -qO- https://get.docker.com/ | sh # version を確認しておく。 docker --version # 以下が表示される # Docker version 1.8.2, build 0a8c2e3 # ユーザーを docker グループに追加 sudo usermod -aG docker $USER docker-machine インストール 続いて、 docker-machine をインストールする。 cd ~/Download wget https://github.com/docker/machine/releases/download/v0.4.1/docker-machine_linux-amd64 sudo mkdir -p /opt/bin sudo mv docker-machine_linux-amd64 /opt/bin/docker-machine sudo chmod +x /opt/bin/docker-machine # docker-machine version 確認 # /opt/bin にパスが通っている事! docker-machine -v # 以下のようにバージョンが表示される # docker-machine version 0.4.1 (e2c88d6) # docker-machin の作成 # docker-machine [--debug] create --driver virtualbox [マシン名] docker-machine --debug create --driver virtualbox dev # エラーがでて以下を実行しろと怒られたので実行。 # sudo /etc/init.d/vboxdrv setup # 再実行時、既に マシンが存在すると怒られるので、以下で削除できる # docker-machine rm dev # docker-machine の一覧表示 docker-machine ls # 以下のような結果が表示される # NAME ACTIVE DRIVER STATE URL SWARM # dev * virtualbox Running tcp://192.168.99.100:2376 # ホストマシンのDocker Remote API のエンドポイントや、certファイルのパスが表示される docker-machine env dev # 以下のような結果が表示される # export DOCKER_TLS_VERIFY="1" # export DOCKER_HOST="tcp://192.168.99.100:2376" # export DOCKER_CERT_PATH="/home/username/.docker/machine/machines/dev" # export DOCKER_MACHINE_NAME="dev" # # Run this command to configure your shell: # # eval "$(docker-machine env dev)" # 指示通り実行 eval "$(docker-machine env dev)" # 上記コマンドで、 `virtual-machine` 上で動くコンテナをあたかもローカルで動いているかのように操作できる。 doker images # REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE # docker/gitlab latest 8e122d458cf4 5 hours ago 654.1 MB # sameersbn/gitlab 8.0.4 e6964ca49453 3 days ago 653.5 MB # sameersbn/redis latest 7bfd2b846d7b 6 weeks ago 196.9 MB # sameersbn/ubuntu 14.04.20150825 2bde99560607 6 weeks ago 194.8 MB # sameersbn/postgresql 9.4-3 6fc4cce07194 9 weeks ago 231.6 MB # 後は docker コマンドで自由に操作するだけ! Tips # ワンライナコマンドオプションの表示 docker-machine config dev # 以下のような結果が表示される # --tlsverify --tlscacert="/home/username/.docker/machine/machines/dev/ca.pem" --tlscert="/home/username/.docker/machine/machines/dev/cert.pem" --tlskey="/home/username/.docker/machine/machines/dev/key.pem" -H=tcp://192.168.99.100:2376% # これを利用して以下でも起動できるらしい # docker $(docker-machine config dev) ps # マシンのストップ docker-machine stop dev # ストップしたマシンのスタート docker-machine start dev # docker machine へ ssh 接続 docker-machine ssh dev # ## . # ## ## ## == # ## ## ## ## ## === # /"""""""""""""""""\___/ === # ~~~ {~~ ~~~~ ~~~ ~~~~ ~~~ ~ / ===- ~~~ # \______ o __/ # \ \ __/ # \____\_______/ # _ _ ____ _ _ # | |__ ___ ___ | |_|___ \ __| | ___ ___| | _____ _ __ # | '_ \ / _ \ / _ \| __| __) / _` |/ _ \ / __| |/ / _ \ '__| # | |_) | (_) | (_) | |_ / __/ (_| | (_) | (__| < __/ | # |_.__/ \___/ \___/ \__|_____\__,_|\___/ \___|_|\_\___|_| # Boot2Docker version 1.8.2, build master : aba6192 - Thu Sep 10 20:58:17 UTC 2015 # Docker version 1.8.2, build 0a8c2e3 # docker machine へ ssh 経由でコマンド発行 docker-machine ssh dev "hostname && uname -a" # 以下が表示される # dev # Linux dev 4.0.9-boot2docker #1 SMP Thu Sep 10 20:39:20 UTC 2015 x86_64 GNU/Linux 参考 Docker Machine を使って VirtualBox に Dockerホストを立てる

2015-10-10 ·  2015-10-10 · 3 分 · 459 文字

Ghost ブログ Export ファイルを変換するスクリプトを書いた

ブログシステムを Ghost へ乗り換えてみたが、 Publish 日付とブログの日付が合わない、といった事象が発生していた。(ブログ再構築の際に順番をいしきしていなかった為、 publish 日付でソートされると、あまり宜しくない結果になった。) 仕方ない、、、と放置していたが、この度簡単なスクリプトを書いて対応した。 node のインストールに若干手こずったが、まぁ、Javascript、簡単! 概要 Ghost 管理メニューより Export した Jsonファイルを用意する。 今回は、ブログタイトルに、記事日付があったので、それを利用した。 title より取り出した 日付で、 publish_at 項目を更新。 本来の日付でソートできた!! vim convertMyGhostExport.js var srcPath = "/home/ghost/Desktop/your-domain.ghost.2015-10-07.json"; var dstPath = "/home/ghost/Desktop/your-domain.ghost.2015-10-07_dst.json"; var json = require(srcPath); json.db[0].data.posts.every(function(post,index,ar){ var dateStr = post.title.substr(0, 8); if (!dateStr.match(/\d{8}/)) { // title の頭8文字が数値出ない場合は対象外 return true; } if (post.status != "published") { // 公開していない場合は対象外 return true; } var yyyy = dateStr.substr(0,4); var mm = dateStr.substr(4,2) - 1; var dd = dateStr.substr(6,2); console.log(dateStr, yyyy, mm, dd); var published = new Date(post.published_at); var newPublished = new Date(post.published_at); // title から作成した日付を設定 newPublished.setFullYear(yyyy, mm, dd); console.log(" old: ==> "+published + "," + published.getTime()); console.log(" new: ==> "+newPublished + "," + newPublished.getTime()); post.published_at = newPublished.getTime(); return true; }); // 変換したJsonを出力 var fs = require('fs'); fs.writeFile(dstPath, JSON.stringify(json, null, ' ')); console.log("Done!"); 実行は、 node 開発環境で、以下を実行 ...

2015-10-08 ·  2023-04-26 · 1 分 · 157 文字