Skip to content

Instantly share code, notes, and snippets.

Avatar

Kouji Nakashima kuc-arc-f

View GitHub Profile
@kuc-arc-f
kuc-arc-f / database.php
Created Oct 13, 2020
Redis, Laravel 7.2 から接続設定の例
View database.php
<?php
use Illuminate\Support\Str;
return [
/*
|--------------------------------------------------------------------------
| Default Database Connection Name
|--------------------------------------------------------------------------
@kuc-arc-f
kuc-arc-f / main.rs
Created Oct 4, 2020
redis ,List 固定データを登録
View main.rs
// redis ,List 固定データを登録
//
extern crate redis;
use redis::{Commands};
//
fn test1() -> redis::RedisResult<()>{
let client = redis::Client::open("redis://localhost/").expect("url error");
let mut connection = client.get_connection().expect("connect error");
@kuc-arc-f
kuc-arc-f / Cargo.toml
Created Oct 2, 2020
Rust + redis, 書込み。シリアライズ、List.rpush
View Cargo.toml
[package]
name = "redis_test"
version = "0.1.0"
authors = ["naka"]
edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
serde = { version = "1.0", features = ["derive"] }
@kuc-arc-f
kuc-arc-f / wasm_proc.js
Created Sep 27, 2020
expressで Rust プロセス起動、jsonファイルから sqlite3登録
View wasm_proc.js
// expressで Rust プロセス起動、jsonファイルから sqlite3登録
var express = require('express');
var router = express.Router();
const { performance } = require('perf_hooks');
const { spawn } = require('child_process');
//
router.get('/', function(req, res, next) {
res.send('respond with a resource-1234');
@kuc-arc-f
kuc-arc-f / Cargo.toml
Last active Sep 27, 2020
Rust, 起動時の引数から sqlite3 登録する処理
View Cargo.toml
[package]
name = "sqlite-test"
version = "0.1.0"
authors = ["naka"]
edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
rusqlite = "0.24.0"
@kuc-arc-f
kuc-arc-f / Cargo.toml
Created Sep 15, 2020
Rust, rusqlite で、sqlite3を操作する例
View Cargo.toml
[dependencies]
rusqlite = "0.24.0"
@kuc-arc-f
kuc-arc-f / Test.js
Last active Sep 14, 2020
Rust Serdeの、Serialize / Deserialize でjavascript変数を渡し、戻り値を取得
View Test.js
// JS
let d = wasm.send_example_to_js();
console.log( d )
let d2 = wasm.receive_example_from_js(d, "f4-from-js")
console.log( d2 )
@kuc-arc-f
kuc-arc-f / main-o3-pub.rs
Created Sep 12, 2020
Rust serde_json , jsonからvec変換と 繰り返し処理の例
View main-o3-pub.rs
// Rust serde_json , jsonからvec変換と 繰り返し処理の例
//
// [dependencies]
// serde = { version = "1.0", features = ["derive"] }
// serde_json = "1.0"
use serde::{Deserialize, Serialize};
use serde_json::{Result, Value};
@kuc-arc-f
kuc-arc-f / main-pub.rs
Created Sep 11, 2020
Rust serde_json ,jsonから、 配列変換(array * object)で、繰り返し処理の例
View main-pub.rs
//
// Rust serde_json ,jsonから、 配列変換(array * object)で、繰り返し処理の例
//
// [dependencies]
// serde = { version = "1.0", features = ["derive"] }
// serde_json = "1.0"
//
use serde::{Deserialize, Serialize};
use serde_json::{Result, Value};
@kuc-arc-f
kuc-arc-f / main-o2-pub.rs
Created Sep 11, 2020
Rust serde_json で、serialized 、デコード(deserialized) ,vect適用する例
View main-o2-pub.rs
//
// Rust serde_json で、serialized 、デコード(deserialized) ,vect適用する例
// 参考:
// https://serde.rs/derive.html
//
use serde::{Deserialize, Serialize};
use serde_json::{Result, Value};
You can’t perform that action at this time.