Skip to content

Instantly share code, notes, and snippets.

View sifyfy's full-sized avatar

Sifi Takashina sifyfy

View GitHub Profile
@sifyfy
sifyfy / main.rs
Created April 9, 2024 07:35
Rust Wasm request_animation_frame example in 2024-04
use gloo::utils::body;
use js_sys::Function;
use wasm_bindgen::closure::Closure;
use web_sys::window;
fn main() {
gloo::console::log!("hello world");
main_loop(0);
}
async fn hoge<E>(executor: &mut E)
where
for<'e> &'e mut E: sqlx::Executor<'e, Database = sqlx::Sqlite>,
{
sqlx::query("").execute(executor).await.unwrap();
}
@sifyfy
sifyfy / main.rs
Created June 1, 2019 21:16
あるtraitを実装している型にだけ異なるtrait実装を与えたいみたいなやつ
struct A;
struct B;
struct C;
struct D;
struct E;
struct F;
struct G;
struct Yes;
@sifyfy
sifyfy / build_diesel_cli.sh
Last active May 1, 2019 18:41
Build AppImage in Docker
#!/bin/bash -ex
############################################################
#
# CentOS 6コンテナでdiesel_cliのAppImageを作る手順
#
############################################################
# 必要なライブラリなどのインストール
yum groupinstall -y "Development Tools"
@sifyfy
sifyfy / main.rs
Created April 20, 2019 23:22
Query build for DDD repository
#[macro_use]
pub mod query_builder {
//! SQL like generic query builder.
//! 構文木の生成までを行うので、それをトラバースして必要な処理を行う。
/// Entityのフィールドを表す型が実装するメソッド
pub trait Field {
/// 演算子の右辺の型
type Data;
}
(() => {
const d = document;
const c_e = () => d.createElement('div');
const e_a = (e, c) => e.appendChild(c);
const set_t = (e, t) => e.textContent = t;
const s = c_e();
const l = c_e();
const r = c_e();
const set_s_t = n => set_t(s, `statuses: ${n}`);
const set_l_t = n => set_t(l, `logins: ${n}`);
@sifyfy
sifyfy / _summary.md
Last active October 4, 2017 08:50
FizzBuzz Benchmark
  • 5回繰り返し実行
  • timeのtotalのベスト
言語 愚直 エレガント
C 0.030 0.028
Nim 0.032 0.055
Rust 0.024 0.049

Step 1. ミラー先にxinetd + rsyncを構成する

データを保存するディレクトリを適当な場所に作り、以下のxinetdとrsyncの設定ファイルを作る。

/etc/xinetd.d/rsync:

service rsync
{
        disable = no ←ここがnoとかfalseになってるのが重要
        flags           = IPv6
 socket_type = stream
#!/bin/bash -e
cd $HOME/.atom
: "Pull config" && {
git pull --rebase
}
: "Update packages" && {
apm uninstall $(apm list -ib | sed -e "s/@.*//")