連番のディレクトリを作りたいとき
こうすると良い
mkdir ch{01..10}
そうすると、
ch01 ch02 ch03 ch04 ch05 ch06 ch07 ch08 ch09 ch10
みたいに連番のディレクトリが作られる。
読書メモなどに便利
Weexってな超イケてるネイティブアプリフレームワークを試してみる【25分でインストール&実機テストまで】
Weexてなによ
アリババが主導で開発していた、ネイティブアプリフレームワーク。 今はapacheプロジェクトに移管されている。
中身はVue。素敵。
インストール編
とりあえず、
npm -g i weex-toolkit webpack webpack-dev-server
を叩いてライブラリ等をインストールする。
そして、サンプルプロジェクトを作る。
weex create weex-sample
以下が実行結果。インタラクティブに回答していけばいい感じにしてくれる。
weex ❯ weex create weex-sample ? May weex-toolkit anonymously report usage statistics to improve the tool over time? Yes ? Which npm registry you perfer to use? npm 23:48:51 : Set telemetry => true 23:48:51 : Set registry => http://registry.npmjs.org Set telemetry = true Set registry = "http://registry.npmjs.org" 23:48:51 : You can config this configuration again by using `weex config [key] [value]` 23:48:51 : Enjoying your coding time! This command need to install weexpack. Installing... ? Project name weex-sample ? Project description A weex project ? Author MozyOk <mozy.okubo@gmail.com> ? Select weex web render lts ? Babel compiler (https://babeljs.io/docs/plugins/#stage-x-experimental-presets) stage-0 ? Use vue-router to manage your view router? (not recommended) No ? Use ESLint to lint your code? Yes ? Pick an ESLint preset Standard ? Set up unit tests Yes ? Should we run `npm install` for you after the project has been created? (recommended) npm 23:53:26 : Generated weex-sample
ファイル生成が終わると、以下のように、コマンド一覧が出るのもナイス。
Success! Created weex-sample at /Users/mozyok/Test/weex/weex-sample Inside that directory, you can run several commands: npm start Starts the development server for you to preview your weex page on browser You can also scan the QR code using weex playground to preview weex page on native npm run dev Open the code compilation task in watch mode npm run ios (Mac only, requires Xcode) Starts the development server and loads your app in an iOS simulator npm run android (Requires Android build tools) Starts the development server and loads your app on a connected Android device or emulator npm run pack:ios (Mac only, requires Xcode) Packaging ios project into ipa package npm run pack:android (Requires Android build tools) Packaging android project into apk package npm run pack:web Packaging html5 project into `web/build` folder npm run test Starts the test runner To get started: cd weex-sample npm start Enjoy your hacking time!
実行してみる
とりあえず、コマンド一覧にしたがって、
$ cd weex-sample $ npm start
を叩いたら、ブラウザで以下のようなサンプルが実行された
このアプリをiPhoneなりにインストールして、QRコードを読み込んでみる。
そうすると、実機のPlayground環境でも動作が試せた。めっちゃお手軽。すごい。
まとめ
マジで15分で実機のPlayground環境で動作確認するまでできた。
Vueなので最近知見も多いし、ガシガシ書いていくと楽しそう。
証拠
1ポモドーロの間に間に合ったぜ。。
【解決】MySQLのpasswordをなしにする
起きた事
local環境で色々遊んでいたところ、databaseを流し込もうとした時に以下のような、password があっていない時に出るエラーが起きた。
Access denied for user 'root'@'localhost' (using password: NO) Couldn't drop database 'test_dev'
解決策
ちょっと手間だったので、mysqlにログインして、passwordの設定をなしにした。
$ mysql -uroot -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 16 Server version: 5.6.39 Homebrew Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> use mysql Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A Database changed mysql> update user set password='' where User='root'; Query OK, 1 row affected (0.01 sec) Rows matched: 1 Changed: 1 Warnings: 0 mysql> flush privileges; Query OK, 0 rows affected (0.00 sec) mysql> quit Bye
$ mysql -uroot Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 17 Server version: 5.6.39 Homebrew Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> quit Bye
passwordなしでログインできるようになった。やったね。
その他
MYSQL_ROOT_PASSWORD とか色々設定方法はあるけど、今回は一瞬だったので、簡単な方法で解決した。
3番地コードってなんだろ
【解決】mysql.server start で Permission denied エラー
起きたこと
mysqlを立ち上げようとしたらPermission deniedでエラーが起きた。
sudoをつけたら正常に起動する状態だった。
$ mysql.server start Starting MySQL ./usr/local/Cellar/mysql@5.6/5.6.39/bin/mysqld_safe: line 138: /usr/local/var/mysql/mozy.local.err: Permission denied
解決方法
/usr/local/var/mysql/
を確認したところパーミッションが、_mysql
となっていたので
sudo chown -R マシンのユーザー名 /usr/local/var/mysql/
例でいうと、sudo chown -R mozy /usr/local/var/mysql/
として解決した。
副作用として、パーミッションが自分のユーザに変わったのでmysql起動時にsudoがいらなくなった。
環境
Mac OS X 10.13.3
【解決】Warning: Use php@7.1 instead of deprecated homebrew/php/php71
起きたこと
phpbrewや、brewでphp環境を構築していたら、ターミナルを立ち上げた時に毎回、以下のようなWarningが出るようになってしまった。
Warning: Use php@7.1 instead of deprecated homebrew/php/php71
解決策
shellの~/.profile
なり、~/.zshrc
の中で
export PATH="$(brew --prefix homebrew/core/php71)/bin:$PATH"
となっている部分を、
export PATH="$(brew --prefix homebrew/core/php@7.1)/bin:$PATH"
と変更したらWarningが出なくなった。
参考サイト
https://gist.github.com/pixeline/51c43c787f51b018d484597f30be3d2b
Go言語の実装を読んでいく【第0回目】
きっかけ
Go言語の実装は読みやすく、理解もしやすいと風の噂で聞いた。
そのため、毎週くらいのペースで徐々にソースコードリーディングをしていこうと思い立った。
どうせならブログで連載すればいいなと思って今回が0回目です。
やったこと
初回はソースコードとバイナリをダウンロードしてきて、コンパイルするところまで。
go1.10.1.darwin-amd64.tar.gz
と、go1.10.1.src.tar.gz
をダウンロードしてきた。
そして実行
$ ./all.bash Building Go cmd/dist using /usr/local/Cellar/go/1.9.4/libexec. (以下略)