Operation Misc
Operation Misc
コマンドソースコード取得
$ rpm -qf /usr/sbin/sshd
openssh-server-6.6.1p1-33.66.amzn1.x86_64
$ yumdownloader --source openssh-server
$ rpm2cpio openssh-7.4p1-16.71.amzn1.src.rpm | cpio -id
$ tar xf openssh-7.4p1.tar.gz
$ cd openssh-7.4p1$ sudo yum list git --show-duplicate
読み込んだプラグイン:priorities, update-motd, upgrade-helper
Repository packages-microsoft-com-prod is listed more than once in the configuration
1126 packages excluded due to repository priority protections
インストール済みパッケージ
git.x86_64 2.14.6-1.62.amzn1 @amzn-updates
利用可能なパッケージ
git.x86_64 2.13.6-2.56.amzn1 amzn-main
git.x86_64 2.14.4-2.58.amzn1 amzn-updates
git.x86_64 2.14.5-1.59.amzn1 amzn-updates
git.x86_64 2.14.5-1.60.amzn1 amzn-updates
git.x86_64 2.14.6-1.61.amzn1 amzn-updates
git.x86_64 2.14.6-1.62.amzn1 amzn-updates
$ yumdownloader --source git-2.14.6-1.62.amzn1
$ rpm -ih git-2.14.6-1.62.amzn1.src.rpm
$ tar xfJ rpmbuild/SOURCES/git-2.14.5.tar.xz 帯域測定
インストール(Amazon Linux AMI)
もしくは
測定
Client側
Server側
Reference
CentOS、RHEL、または Amazon Linux が実行されている Amazon EC2 インスタンスに対して EPEL リポジトリを有効にする方法を教えてください。
https://aws.amazon.com/jp/premiumsupport/knowledge-center/ec2-enable-epel/
同じ VPC 内で Amazon EC2 Linux インスタンス間のネットワークスループットをベンチマークする方法を教えてください。
https://aws.amazon.com/jp/premiumsupport/knowledge-center/network-throughput-benchmark-linux-ec2/
OpenSSL
OpenSSL で自己署名証明書作成
Reference
Title: CommandSnippet
URL: https://w.amazon.com/bin/view/AmazonWebServices/SalesSupport/DeveloperSupport-JP/EC2/Linux/CommandSnippet
RHEL
サブスクリプション更新
Linuxタブをクリックし、 Download RHEL > TRY ITのDOWNLOADをクリック
必要項目を入力して更新
(参考) Red Hat Developer Program参加とRHEL無償サブスクリプションの取得&更新
Squid
Squid で Forward Proxy 構築(デフォルトで Private IP アドレスレンジからはつながる)
Amazon Linux AMI, RHEL/CentOS 6
Squid で Forward Proxy 構築(BASIC 認証必須)
Amazon Linux AMI, RHEL/CentOS 6
HHKB
Happy Hacking Keyboard Professional2
SW1をONにしてMacintoshモードへ変更。
SW2をONにして左◇をFnキーへ変更。
SW6をONにしてPCが省電力モードでもHHKBが使用できるように変更。
背面スイッチの説明
https://www.pfu.fujitsu.com/hhkeyboard/leaflet/hhkb_backview.html
Error
サーバに秘密鍵を置かないでデプロイ
Capistranoで Permission denied (publickey) のエラー
解決策
(※) ローカルでSSH agentを立ち上げ秘密鍵の登録
Capistranoでforward_agentの設定
ENV['DEPLOY_PROUDCTION_KEY']は秘密鍵のパス
(※) GitHubにpullする対象となるレポジトリに公開鍵を登録する。
プロジェクトのトップページ(https://github.com/<レポジトリ名>/<プロジェクト名>)で SettingsからDeploy keysを選択。
[add deploy key]を選択して、TitleにGitHub上のDeploy keysで表示される識別名(なんでもいい)を入力し、keyに公開鍵の中身(cat ~/.ssh/id_rsa.pubしたもの)を入力する。
Eclipse
エラー: メイン・クラスcom.leetcode.problem.p1.P1が見つからなかったかロードできませんでした
ProjectタブのPropertiesを選択される画面のJava Build PathのLibrariesを選択。 Modulepathを選択した状態で"Add Library..."を選択。 JRE System Libraryを選択してNextを選択後、"Installed JREs..."を選択し、"Add..."をクリック。 以下のように内容を入力し、Finishを選択。
Installed JRE Types: MacOS X VM JRE home: /Library/Java/JavaVirtualMachines/jdk-11.0.4.jdk/Contents/Home JRE name: 自分で識別するための任意の名前(例. Java SE 11)
設定したJREにチェックを入れて"Apply and Close"を選択。
“Build path entry is missing” error when trying to create a new project in Eclipse https://stackoverflow.com/questions/12252123/build-path-entry-is-missing-error-when-trying-to-create-a-new-project-in-eclip
Exception in thread "main" java.lang.UnsupportedClassVersionError: com/leetcode/problem/p1/P1 has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0
ProjectタブのPropertiesを選択される画面のJava ComplilerのCompiler compliance levelにおけるレベルの不一致を表すようなエラーだが、 ProjectタブのClean...を選択で解消。
Eclipse が起動しない
以下のエラーで Eclipse が起動できない。
~/eclipse/java-neon/Eclipse.app/Contents/Eclipse/eclipse.ini のファイル中の以下の箇所を編集
編集後
バージョンは以下のように確認
参考: https://stackoverflow.com/questions/45090016/eclipse-no-java-virtual-machine-was-found-after-searching-the-following-locatio
Debian のコンテナで apt-get install -y vim すると、E: Unable to locate package vim
以下で解消
https://qiita.com/sivertigo/items/2211fc90cf13e0173cf3
Vim
補完が利かない
Vim補完が利かず、Tabを押すと以下のようなエラー。
.zcompdumpというzshの補完ファイルのダンプファイルを消去してログインシェルとして入る。
http://qiita.com/Asuforce/items/28b287fdb933d1985e15
VSCode
ターミナルからファイルを開く
インストール
Command + Shift + Pでコマンドパレット開く
Shell command 'code' successfully installed in PATHを検索して実行
実行
References
Topic
Docker
Get started
Resource Tutorial of Docker for Mac
Docker イメージを作るコツ
docker run -it centos:6 /bin/bashのように起動して-yや-fなどを活用したり不要なログを抑えるようにcurl -sやwget -qを利用しながら作業コマンドをメモしていきうまく行ったらDockerfileにする。
RUNのあと&&で繋いて一つにまとめるとよい。←Dockerは各操作ごとにレイヤーを作り、それらイメージの集合体のイメージを利用することになる。
失敗したら、exitしてrunからやり直すか、うまくいくところまででいったんexit&docker commitして続きからやり直すと良い。
一連のコマンドのどこで失敗したかを標準エラー出力するようにRUNからset -xにつながて記述していっても良い。
http://qiita.com/pottava/items/452bf80e334bc1fee69a http://wazanova.jp/items/1454 http://docs.docker.jp/engine/articles/dockerfile_best-practice.html
docker buildでは実行ディレクトリにあるファイルやディレクトリをすべて含める形で実行されてしまう → .dockerignoreの活用
Docker: ERROR: for app No such image: sha256:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
ERROR: Encountered errors while bringing up the project.
参考 https://github.com/docker/compose/issues/1113
DockerでIPアドレス出力
DockerでNode.js
fucking debian installs node as nodejs
を追加する必要がある。
https://gist.github.com/thom-nic/724a2af410e90a654e35
docker pull php:5.6-apache でフリーズする問題
以下のようにして解決
参考 http://qiita.com/t-mochizuki/items/d8d5af2b2d322a3ce84a
client is newer than server
docker-machineのバージョンがdockerのバージョンより古い。 以下を実行する。
bashdocker-machine upgrade default
参考 http://qiita.com/hidekuro/items/23dcafe6393e5f0d5791
Docker composeの設定
Dockerでマウントしたファイルの権限が問題になった時
Apacheの設定とディレクトリの権限の違いなので、Dockerfileに以下を追記
参考
http://qiita.com/suin/items/3a0361102af83d0b69aa
その他
http://qiita.com/s0hno/items/3ac527d749a91e293ed9
http://sessan.hatenablog.com/entry/2016/04/30/225316
DockerでPHPモジュールのインストールが詰まった
Dockerfileに以下を追記
gd
ImageMagick
Vagrant
Default pass: vagrant
default: Warning: Authentication failure. Retrying...でvagrant upしない
/home/vagrantのパーミッションが不適切なので変更(sshの仕様)
参考
http://qiita.com/jshimazu/items/9db49ce64478e82d511e
iOS
pod set upができない
CocoaPodsの導入でpod set upできない時
解決方法
YAML.load functionの問題
全体
参考 https://github.com/CocoaPods/CocoaPods/issues/2908
Tips
JSONデータ抜き出し
IPアドレス分析
Address: 52.95.255.48 00110100.01011111.11111111. 00110000 Netmask: 255.255.255.0 = 24 11111111.11111111.11111111. 00000000 Wildcard: 0.0.0.255 00000000.00000000.00000000. 11111111 => Network: 52.95.255.0/24 00110100.01011111.11111111. 00000000 HostMin: 52.95.255.1 00110100.01011111.11111111. 00000001 HostMax: 52.95.255.254 00110100.01011111.11111111. 11111110 Broadcast: 52.95.255.255 00110100.01011111.11111111. 11111111 Hosts/Net: 254 Class A
Brewfile 自動生成
パブリックIP取得
Android どの程度@NonNull,例外をつけるか
そのクラスを使用する人がどこまで信用できるか http://techlife.cookpad.com/entry/2015/02/20/195000
スーパーユーザーから別のユーザーにログインできない
scp -i <秘密鍵>でNot a directoryが出るエラー
-iオプションはscpコマンド直後に置く
インフラエンジニアとしてよく使うコマンド集
http://qiita.com/sion_cojp/items/04a2aa76a1021fe77079?utm_content=buffer5c76e&utm_medium=social&utm_source=twitter.com&utm_campaign=buffer
historyコマンドをlessコマンドで遡る
対象の行番号を削除する
秘密鍵の情報変更
vimでPHPのLintツールの導入(PSR-2)
NeoBundleのインストール
.vimrc.を以下のように編集する
プラグインの有効化
vimのコマンドラインモードで:NeoBundleInstallを実行して有効化する。
無効化は、.vimrcで該当プラグインを削除してから:NeoBundleCleanを実行する。
参考 http://tm.root-n.com/unix:command:vim:plugin:neobundle
PHP 設定確認
参考
http://blog.xcir.net/?p=1811
SSHでホストが変わった時の接続
(参考)https://www.uramiraikan.net/Works/entry-1970.html
MacにNode.jsを入れる
http://arfyasu.hatenablog.com/entry/2016/01/26/212543
UbuntuでNode.jsを最新版にする(v.6.2.2)
apt updateの最新版だと
GitHubにSSH
ssh-addでエラーが出る
以下のコマンドを打つ。
パス設定
git管理下からレポジトリ外で.gitignore管理
home直下に.gitignoreを置いて以下を記述する
.gitconfigで先ほどの.gitignoreファイルをexcludesfileを指定する
Network
macOSにipコマンドのインストール
brew install iproute2mac
iOS
iOS: Unknown error calling sqlite3_step (11: database disk image is malformed) eu
Unknown error calling sqlite3_step (11: database disk image is malformed) eu一旦アプリを消して入れ直す。
iOS: TableViewとCustomセルの実装
UITableViewDelegate, UITableViewDataSourceを追加。StoryBoardからドラッグしてdataSourceとdelegateの関連付けをして、viewDidLoad()に以下を追加。
3.tableViewの各種メソッドを追加。
http://yuu.1000quu.com/use_a_custom_cell_in_swift
iOS: タブバーの実装
TabBarControllerを作って、以下を記述。
各ViewControllerに以下のように記述。
iOS: Code Sign error : Command /usr/bin/codesign failed with exit code 1が出た時の対処
Code Sign error : Command /usr/bin/codesign failed with exit code 1が出た時の対処bundle format unrecognized, invalid, or unsuitableというエラーもTraceに出ており、プロジェクトにResourcesというディレクトリを作っていたことが原因。
http://stackoverflow.com/questions/29271548/code-sign-error-bundle-format-unrecognized-invalid-or-unsuitable
iOS: Bridging HeaderからObjective-Cファイルが読み込めない
Build SettingsでPackaging > Defines ModuleをYesにする。
http://takerpg.hatenablog.jp/entry/2014/12/02/223702
XCTestでUse of undeclared type 'Todo' does not have a member named 'todo'のエラーが出てたときの対処
Use of undeclared type 'Todo' does not have a member named 'todo'のエラーが出てたときの対処の追加のし忘れかも。
http://yanamura.hatenablog.com/entry/2014/12/27/150454
Apache Spark
Exception in thread "main" java.lang.IllegalArgumentException: Field "x" does not exist.
sourceのcsvの先頭が
と始めないといけない。x,yの行が必要。
AWS
CodeCommitで突然403
KeyChain Accessのアプリを開き、codecommitで検索。アクセス制御でURLをマイナスで削除。
http://docs.aws.amazon.com/ja_jp/codecommit/latest/userguide/troubleshooting.html#troubleshooting-macoshttps
DynamoDBローカル インストール
確認
JSからS3に直接画像のアップロード
S3のCORSの設定で以下のように記述する。
利用料金をSlackに毎日通知
1.アカウント > 設定 から 請求アラートを受け取る を選択して請求額通知を有効化する。
2.SlackをHookするURLを取得する。
3.LambdaでCron設定で毎日回して以下のコードとライブラリをzipにしてアップロードする。
参考
http://docs.aws.amazon.com/ja_jp/AmazonCloudWatch/latest/monitoring/monitor_estimated_charges_with_cloudwatch.html
http://qiita.com/saku/items/fc6b70a420a5c510de2b
AWSシークレットキーをcommitするのを防止
Basic認証下のHealth checkが401が返る
2通りの方法 1.Health check用のURLを設定 2.PingプロトコルをTCPへ変更
参考
http://stackoverflow.com/questions/23921370/aws-load-balancer-with-no-health-check-or-make-it-work-with-non-200-response
http://5net.com/blog/2010/12/elb-healthcheck-with-apache-basicauth.html
Lambdaでzipでアップロードするときの注意点
ライブラリのinstallのし忘れに注意する(※アップロードするディレクトリ内に含める)
(参考)http://qiita.com/Hironsan/items/0eb5578f3321c72637b4
zip化してアップロードする
確認方法
以下のコマンドを入力する
依存ライブラリの管理方法
http://dev.classmethod.jp/cloud/deploy-aws-lambda-python-with-lambda-uploader/
AWS EC2でELB配下のどれか1台でのみ実行
参考
http://qiita.com/idaaki/items/a356d1785a59d4150358
S3 バケット容量 確認(2通り)
Last updated