Skip to content

Instantly share code, notes, and snippets.

View ubnt-intrepid's full-sized avatar
🦀
I may be slow to respond.

Yusuke Sasaki ubnt-intrepid

🦀
I may be slow to respond.
View GitHub Profile
// 失敗する例 (オリジナル: https://gist.github.com/cohama/73a90d99fa036030393727ecd51fcb13)
// 何が起きているのかを明示するため若干修正済み。
fn main() {
let k0 = |r| println!("{:?}", r); // このクロージャの型を仮に K0 とする
repeat_cps(10, "hello", Box::new(k0)); // repeat_cps::<&'static str, (), K0> がインスタンス化される
}
// 型パラメータを持つ場合、それらの型「すべて」が確定したときに関数は初めて実体化される(C++と同じ)。
call plug#begin('~/.local/share/nvim/plugged')
Plug 'tomtom/tcomment_vim'
Plug 'mklabs/split-term.vim'
Plug 'rakr/vim-two-firewatch'
Plug 'hzchirs/vim-material'
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
Plug 'Shougo/echodoc.vim'
@ubnt-intrepid
ubnt-intrepid / mir.txt
Created June 5, 2017 16:22 — forked from anonymous/playground.rs
Shared via Rust Playground
// WARNING: This output format is intended for human consumers only
// and is subject to change without notice. Knock yourself out.
static <impl at <anon>:11:1: 33:2>::display::__STATIC_FMTSTR: &[&str] = {
let mut _0: &[&str]; // return pointer
let mut _1: &[&str; 2];
let mut _2: &[&str; 2];
let mut _3: [&str; 2];
bb0: {
_3 = [const "", const "\n"]; // scope 0 at <println macros>:3:18: 3:43
@ubnt-intrepid
ubnt-intrepid / README.md
Created April 26, 2017 03:45
Emscripten ビルド用 Vagrantfile

使い方

$ vagrant ssh -c "cd /vagrant; rustc --target=wasm32-unknown-emscripten hello.rs"

Keybase proof

I hereby claim:

  • I am ubnt-intrepid on github.
  • I am ubnt_intrepid (https://keybase.io/ubnt_intrepid) on keybase.
  • I have a public key ASBfMbdQVepmekRFwK86hKRejg3eKoSLHQc_TtkxLhhTUgo

To claim this, I am signing this object:

@ubnt-intrepid
ubnt-intrepid / README.md
Created April 6, 2017 18:44
c:\windows\system32\bash.exe 経由で任意のコマンドを手軽に実行できるやつ(要は wslbridge の簡易版)

Usage:

> $command = "vim"
> rustc -C opt-level=3 -C debuginfo=0 -o "C:\path\to\$($command).exe" wsl.rs
> C:\path\to\vim.exe .\wsl.rs

TODO:

  • Windows 側のパスを受け取った場合の対処

Instruction

  • Put files into:

    • Vagrantfile => ./Vagrantfile
    • exclude => ./git/info/exclude
  • Run provisioner:

    $ vagrant up
@ubnt-intrepid
ubnt-intrepid / rhq.md
Created February 14, 2017 10:53
Documentation of `rhq`

Usage

  • rhq clone [query] [arguments...]
    aaa

  • rhq list

  • rhq config

  • ...

# HTTP protocol
http[s]://HOST[:PORT]/ORGANIZATION/REPOSITORY.git
# Git protocol
git://HOST/ORGANIZATION/REPOSITORY.git
# SSH protocol
[ssh://]SSHUSER@HOST[:PORT]/ORGANIZATION/REPOSITORY.git
@ubnt-intrepid
ubnt-intrepid / file0.txt
Created January 1, 2017 03:18
Rust と Electron で GUI アプリケーションを作る ref: http://qiita.com/ubnt_intrepid/items/cf4e1cc6d6e5b3b23ca8
#[macro_use]
extern crate itertools;
use std::cmp;
use itertools::Itertools;
pub fn mandelbrot(buffer: &mut [u8], width: i64, height: i64, pixel_size: f64, x0: f64, y0: f64) {
iproduct!((0..width), (0..height)).foreach(|(i, j)| {
let cr = x0 + pixel_size * (i as f64);
let ci = y0 + pixel_size * (j as f64);