Tumgik
mtakagi · 3 years
Quote
常備軍とは常置政府がふりまわす腕にすぎない。その政府にしても、人民がみずからの意思を遂行するために選んだ方式にすぎないのだが、人民がそれを通じて行動を起こすことができないでいるうちに、ともすれば政府そのものが常備軍とおなじように乱用され悪用されることになりかねない。
H・D・ソロー著 飯田 実訳
市民の反抗 他5篇 岩波文庫 P8より
150年以上前にソローが指摘していた事が今も起きてるという現実
1 note · View note
mtakagi · 4 years
Text
コンパイラは知っている
➜ Desktop clang -o fuck fuck.c fuck.c:3:2: warning: implicitly declaring library function 'printf' with type 'int (const char *, ...)' [-Wimplicit-function-declaration] printf("fuck\n"); ^ fuck.c:3:2: note: include the header <stdio.h> or explicitly provide a declaration for 'printf' 1 warning generated. ➜ Desktop ./fuck fuck
def ext_implicit_lib_function_decl : ExtWarn "implicitly declaring library function '%0' with type %1">, InGroup<implicitfunctiondeclare>; def note_include_header_or_declare : Note "include the header or explicitly provide a declaration for '%1'">;
DiagnosticSemaKinds.td </stdio.h>
2 notes · View notes
mtakagi · 4 years
Text
2020年度版 PhantomJS のビルド(macOS篇)
2020年度版 PhantomJS のビルド
何故か今になって PhontomJS をビルドしていみる。
下準備
Xcode はインストール済みとする
QT5 のインストール
ここは簡単Honebrewを使用してインスールするだけ
brew install qt5
これで全て上手く行く。ここまでは。
QTWebKit のビルド
この GitHub Wiki Building QtWebKit on macOS を参考にビルド
必要なもの
git clone https://github.com/qtwebkit/qtwebkit.git
QTWebKit のリポジトリをクローン
brew install conan
パッケージマネージャのインストール (pip3 install conan でもインストール可能)
ビルド
Tools/qt/build-qtwebkit-conan.py --qt=<path_to_your_qt_installation> [--install]
--install オプションとして渡すと指定した QT のパスにインストールされる
Homebrew でインストールされた QT のパスにインストールする場合は以下のようになる
Tools/qt/build-qtwebkit-conan.py --qt=/usr/local/Cellar/qt/5.15.1 --install
しかし WebKit のビルドなので相当ビルド時間がかかる。詳細は後述するが、生成された QtWebKit.Framework などのリンクパスがおかしかったりした。
PhantomJS のビルド
git clone https://github.com/ariya/phantomjs.git で Git からクローンし phontomjs ディレクトリに移動
CMake の Find_Package が検索するパスに QT の CMake ファイルが含まれるように export CMAKE_PREFIX_PATH=/usr/local/Cellar/qt/5.15.1 を設定して ./configure
しかし
CMake エラー
Checking file [/usr/local/Cellar/qt/5.15.1/lib/cmake/Qt5/Qt5Config.cmake] Checking file [/usr/local/Cellar/qt/5.15.1/lib/cmake/Qt5Core/Qt5CoreConfig.cmake] Checking file [/usr/local/Cellar/qt/5.15.1/lib/cmake/Qt5Network/Qt5NetworkConfig.cmake] Checking file [/usr/local/Cellar/qt/5.15.1/lib/cmake/Qt5WebKitWidgets/Qt5WebKitWidgetsConfig.cmake] Checking file [/usr/local/Cellar/qt/5.15.1/lib/cmake/Qt5WebKit/Qt5WebKitConfig.cmake] Checking file [/usr/local/Cellar/qt/5.15.1/lib/cmake/Qt5Gui/Qt5GuiConfig.cmake] CMake Error at /usr/local/Cellar/qt/5.15.1/lib/cmake/Qt5WebKit/Qt5WebKitConfig.cmake:100 (get_target_property): get_target_property() called with non-existent target "Qt5::WebKit". Call Stack (most recent call first): /usr/local/Cellar/cmake/3.12.2/share/cmake/Modules/CMakeFindDependencyMacro.cmake:48 (find_package) /usr/local/Cellar/qt/5.15.1/lib/cmake/Qt5WebKitWidgets/Qt5WebKitWidgetsConfig.cmake:83 (find_dependency) /usr/local/Cellar/qt/5.15.1/lib/cmake/Qt5/Qt5Config.cmake:28 (find_package) CMakeLists.txt:6 (find_package) CMake Error at /usr/local/Cellar/qt/5.15.1/lib/cmake/Qt5WebKit/Qt5WebKitConfig.cmake:101 (get_target_property): get_target_property() called with non-existent target "Qt5::WebKit". Call Stack (most recent call first): /usr/local/Cellar/cmake/3.12.2/share/cmake/Modules/CMakeFindDependencyMacro.cmake:48 (find_package) /usr/local/Cellar/qt/5.15.1/lib/cmake/Qt5WebKitWidgets/Qt5WebKitWidgetsConfig.cmake:83 (find_dependency) /usr/local/Cellar/qt/5.15.1/lib/cmake/Qt5/Qt5Config.cmake:28 (find_package) CMakeLists.txt:6 (find_package) CMake Error at /usr/local/Cellar/qt/5.15.1/lib/cmake/Qt5WebKit/Qt5WebKitConfig.cmake:118 (get_target_property): get_target_property() called with non-existent target "Qt5::WebKit". Call Stack (most recent call first): /usr/local/Cellar/cmake/3.12.2/share/cmake/Modules/CMakeFindDependencyMacro.cmake:48 (find_package) /usr/local/Cellar/qt/5.15.1/lib/cmake/Qt5WebKitWidgets/Qt5WebKitWidgetsConfig.cmake:83 (find_dependency) /usr/local/Cellar/qt/5.15.1/lib/cmake/Qt5/Qt5Config.cmake:28 (find_package) CMakeLists.txt:6 (find_package)
とエラーが発生。しかたなく QT5::WebKit となっている箇所を QT5::WebKitLegacy と書き換える事で対応。再度 ./configure && make
export CMAKE_PREFIX_PATH=/usr/local/Cellar/qt/5.15.1; ./configure && make
あとはできあがった bin/phnatomjs を実行できれば OK なのだが……
とりあえずの仕上げ
エラーで動作しない!
実行しようとすると
Scanning dependencies of target check FATAL: Version check failed ## dyld: Library not loaded: QtWebKitWidgets.framework/Versions/5/QtWebKitWidgets ## Referenced from: /Users/mtakagi/Downloads/phantomjs/bin/phantomjs ## Reason: image not found
とあえなく表示されエラーで動作せず。
otool -l でリンクされているフレームワークを調べる。
otool -L bin/phantomjs bin/phantomjs: /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1281.0.0) QtWebKitWidgets.framework/Versions/5/QtWebKitWidgets (compatibility version 5.212.0, current version 5.212.0) /usr/local/opt/qt/lib/QtWidgets.framework/Versions/5/QtWidgets (compatibility version 5.15.0, current version 5.15.1) QtWebKit.framework/Versions/5/QtWebKit (compatibility version 5.212.0, current version 5.212.0) /usr/local/opt/qt/lib/QtNetwork.framework/Versions/5/QtNetwork (compatibility version 5.15.0, current version 5.15.1) /usr/local/opt/qt/lib/QtGui.framework/Versions/5/QtGui (compatibility version 5.15.0, current version 5.15.1) /usr/local/opt/qt/lib/QtCore.framework/Versions/5/QtCore (compatibility version 5.15.0, current version 5.15.1) /usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 800.7.0)
QtWebKitWidgets.Frameworks と QtWebKit.framework/Versions/5/QtWebKit のパスがカレントからロードされるようにみえる。 そこで install_name_tool を使用しリンクパスを修正する事にした。
リンクしたフレームワークのパスの変更
install_name_tool を使用しphantomjsのリンクを以下のように修正
install_name_tool -change QtWebKitWidgets.framework/Versions/5/QtWebKitWidgets /usr/local/opt/qt/lib/QtWebKitWidgets.framework/Versions/5/QtWebKitWidgets bin/phantomjs install_name_tool -change QtWebKit.framework/Versions/5/QtWebKit /usr/local/opt/qt/lib/QtWebKit.framework/Versions/5/QtWebKit bin/phantomjs
しかし phantomjs を実行しようとすると無情にも
FATAL: Version check failed ## dyld: Library not loaded: QtWebKit.framework/Versions/5/QtWebKit ## Referenced from: /usr/local/Cellar/qt/5.15.1/lib/QtWebKitWidgets.framework/Versions/5/QtWebKitWidgets ## Reason: image not found ## exit -6
ビルドした QTWebKtWidgets のロードするフレームワークがパスおかしかったのです。そこで再度QtWebKitWidgets に install_name_tool で以下のように修正したところ
install_name_tool -change QtWebKit.framework/Versions/5/QtWebKit /usr/local/opt/qt/lib/QtWebKit.framework/Versions/5/QtWebKit /usr/local/Cellar/qt/5.15.1/lib/QtWebKitWidgets.framework/Versions/5/QtWebKitWidgets
一通り完了
var sys = require("system") sys.stdout.write("hello, world!"); phantom.exit();
実行成功?
bin/phantomjs hello.js hello, world!%
1 note · View note
mtakagi · 4 years
Text
これはひどい
0 notes
mtakagi · 4 years
Link
10年以上前の更新してないページを、今更 GitHub Pages に移行してみた。 ちなみに元の URL はこれ。 http://outofboundary.web.fc2.com/dat_quicklook.html
0 notes
mtakagi · 4 years
Text
SF Mono
久しぶりに Xcode 使って思ったけど、SF Mono が良い感じなので VS Code も SF Mono にしてみた。
ビフォアー
Tumblr media
アフター
Tumblr media
ダウンロードはこちらから。
4 notes · View notes
mtakagi · 4 years
Link
def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) # create the background task and run it in the background self.bg_task = self.loop.create_task(self.my_background_task())
discord.py/background_task.py at master · Rapptz/discord.py
discord.py で定期的に bot に発言させようと思って知らべたら、サンプルコードは普通に asyncio の loop でタスク作ってた。 ちなみにサンプルは discord.Client のサブクラスを作ってるけど loop を作ってそれでタスクを生成してdiscord.Client のコンストラクタに渡せば同じような事はできると思う。
0 notes
mtakagi · 4 years
Text
count += 1 else: category = array[count] title = array[count + 1] maker = array[count + 2] price = array[count + 3]
しーげんごみたいな書き方をして大変申し訳
0 notes
mtakagi · 4 years
Text
再度Chromebook にインストールしたもの
インストールしたもの
nasm
make
qemu-system
bocsh
gitkraken
python
VS-Code
ログ https://gist.github.com/mtakagi/da7d7262a2448f38739642365e544d26
0 notes
mtakagi · 4 years
Text
https://gist.github.com/mtakagi/24368fb8a1592a89849e0d84cc1c3790
やっぱり結構違う。
0 notes
mtakagi · 4 years
Photo
Tumblr media Tumblr media Tumblr media Tumblr media
Android Flash Tool お断りリスト
0 notes
mtakagi · 4 years
Link
MediaPad M3 が USB デバッグにつながらなくって調べた。 ファイル転送オンからの USB デバッグ有効のオン・オフ・オンの謎手順
0 notes
mtakagi · 4 years
Photo
Tumblr media
Android 10 にしたけど違いがわからない
0 notes
mtakagi · 4 years
Text
くすりを大量に飲んでも寝れないんだよね。
0 notes
mtakagi · 4 years
Text
Monospace
Tumblr media
ソースコードのフォントを設定しようと思って、参考に GitHub のフォント指定を見てみたら
font-family: SFMono-Regular, Consolas, Liberation Mono, Menlo, monospace;
の5つのフォントが指定されてた。 SFMono-Regular は Xcode や ターミナルアプリで使用されている等幅フォント。 Consolas は Windows で使用されている等幅フォント。
それぞれ Apple と マイクロソフトのサイトからダウンロードできる。 
Liberation Mono はオープンソースのフォントで GitHub にリポジトリがある。
0 notes
mtakagi · 4 years
Text
The default interactive shell is now zsh. To update your account to use zsh, please run `chsh -s /bin/zsh`. For more details, please visit https://support.apple.com/kb/HT208050.
なんか怒られた。zsh にしてなかったけ…
0 notes
mtakagi · 6 years
Link
セイレム攻略の合間に実装した Swift 4 の Codable 実験用の MessagePackEncoder の encode 方だけが動くようになりました。。。
0 notes