Raspberry PiでもJuliaが動く件
こんにちは、@kjunichiです。 この記事は、@kjunichiの2018年パーソナルアドベントカレンダーの5日目の記事です。
1.0.0もあった
JuliaBerry: Julia on the Raspberry Pi
sudo apt install julia
では0.6版がインストールされる。公式のArm版は1.0.0と他のプラットフォームよりやや古いが 手動でインストールできる。
また、IJuliaはaptでPython3関連を入れて、pip3でjupyterをインストールしてから 入れる必要があった。(Pkg.add("IJulia")だけやったら、インストールに失敗した人)
LEDを点滅させる奴も用意されている。
Arm64ビット向けは現在解決しないといけない問題があって鋭意対応中の模様。
関連記事
- Juliaでaobenchを使って並列処理を試した その1
- 陰関数の仮想3D空間へのプロットあるいは、ラズパイ版マインクラフト(mcpi)にたけのこの里を出す
- Juliaでゼータ関数を直接jupyterにプロットしたり、マインクラフト(MCPI)にプロットした
- Raspberry Pi3でTensorflowをビルドして動かした
- Raspberry Piの温度をgRPCを使ってElectronで作ったデスクトップマスコットに表示させた
- Julia言語で久しぶりにHTTPをHTTP.jlやソケット通信で喋ってみた - non vorrei lavorare
6年前の記事
4年前の記事
3年前の記事
1年前の記事
1年前の記事
Minecraft Win10版にnode.js以外でGo言語でもつなげた
おはようございます。@kjunichiです。 この記事は、@kjunichiの2018年パーソナルアドベントカレンダーの4日目の記事です。
Goでもつながった
昨日はJulia,PythonはMinecraftのWin10版から/connectコマンドでWebSocket接続ができなかったが、 Goで試したら出来た
試したコード:
package main import ( "io" "net/http" "golang.org/x/net/websocket" ) func echoHandler(ws *websocket.Conn) { io.Copy(ws, ws) } func main() { http.HandleFunc("/echo", func(w http.ResponseWriter, req *http.Request) { s := websocket.Server{Handler: websocket.Handler(echoHandler)} s.ServeHTTP(w, req) }) http.Handle("/", http.FileServer(http.Dir("./"))) if err := http.ListenAndServe(":9999", nil); err != nil { panic("ListenAndServe: " + err.Error()) } }
参考資料
関連記事
- Goオールスターズ2に行くので、gopheronをGo言語で動かせるようにした #websocket
- node.jsのwsモジュールによるWebSocketとPythonやJuliaのWebSocketの違い
- 陰関数の仮想3D空間へのプロットあるいは、ラズパイ版マインクラフト(mcpi)にたけのこの里を出す
WebSocketつながり
- Safariだとオレオレ証明書でWebSocketが使えない!?
- JuliaでWebSocketを扱うには
- node.jsのwsモジュールによるWebSocketとPythonやJuliaのWebSocketの違い
13年前の記事
5年前の記事
4年前の記事
3年前の記事
2年前の記事
1年前の記事
node.jsのwsモジュールによるWebSocketとPythonやJuliaのWebSocketの違い
おはようございます。@kjunichiです。 この記事は、@kjunichiの2018年パーソナルアドベントカレンダーの3日目の記事です。
マイクラBE版とのWebSocket接続
マイクラBE版(Minecraft Win10)から/connectコマンドでnode.jsのwsではつながるのに、昨日紹介したJuliaやPythonのWebSocketのライブラリで 作ったサーバーへ接続しても何故かつながらない模様。
つながらないPython
from websocket_server import WebsocketServer # Called for every client connecting (after handshake) def new_client(client, server): print("New client connected and was given id %d" % client['id']) server.send_message_to_all("Hey all, a new client has joined us") # Called for every client disconnecting def client_left(client, server): print("Client(%d) disconnected" % client['id']) # Called when a client sends a message def message_received(client, server, message): if len(message) > 200: message = message[:200]+'..' print("Client(%d) said: %s" % (client['id'], message)) PORT=9001 server = WebsocketServer(PORT) server.set_fn_new_client(new_client) server.set_fn_client_left(client_left) server.set_fn_message_received(message_received) server.run_forever()
つながるnode.jsのコード
const WebSocket = require('ws'); const app = require('express')(); const server = require('http').Server(app); const uuid = require('uuid/v4'); const wss = new WebSocket.Server({server}); wss.on('connection', socket => { console.log('user connected'); socket.on('message', packet => { }); }); server.listen(3000, () => { console.log('listening on *:3000'); });
参考資料
関連記事
- Safariだとオレオレ証明書でWebSocketが使えない!?
- Goオールスターズ2に行くので、gopheronをGo言語で動かせるようにした #websocket
- JuliaでWebSocketを扱うには
- Minecraft Win10版にnode.js以外でGo言語でもつなげた