Skip to content

Instantly share code, notes, and snippets.

@Nnwww
Nnwww / tmux.conf
Created June 3, 2018 13:29
tmux for macOS
set -s escape-time 0
set-option -g default-terminal screen-256color
# Keybind
unbind-key C-b
set-option -g prefix C-q
bind-key C-q send-prefix
# vimのキーバインドでペインを移動する
bind h select-pane -L
bind j select-pane -D
@Nnwww
Nnwww / conf.json
Created June 1, 2018 23:35
vim vixsen conf
{
"keymaps": {
"0": { "type": "scroll.home" },
":": { "type": "command.show" },
"o": { "type": "command.show.open", "alter": false },
"O": { "type": "command.show.open", "alter": true },
"t": { "type": "command.show.tabopen", "alter": false, "background": true },
"T": { "type": "command.show.tabopen", "alter": true },
"w": { "type": "command.show.winopen", "alter": false },
"W": { "type": "command.show.winopen", "alter": true },

Keybase proof

I hereby claim:

  • I am nnwww on github.
  • I am nnwww (https://keybase.io/nnwww) on keybase.
  • I have a public key ASCkaaxIxWVQEjDeQzws2_EgZkIswByTXfGNN9ayO7TYoQo

To claim this, I am signing this object:

@Nnwww
Nnwww / getobjinfos.py
Last active December 18, 2017 06:29
A function added inspect.getmember to obtaining method's signatures.
import inspect
def getobjinfos(obj, pred=lambda a: True):
for symbolstr, value in inspect.getmembers(obj, pred):
yield (value, symbolstr , inspect.signature(value)) if inspect.ismethod(value) else (value, symbolstr)
@Nnwww
Nnwww / SigmoidBench.hs
Last active October 12, 2017 05:53
naive sigmoid vs memorized sigmoid in Haskell
#!/usr/bin/env stack
{- stack --resolver lts-8.23 --install-ghc runghc
--package criterion --package vector
-}
{-# LANGUAGE StrictData #-}
import Criterion.Main
import qualified Data.Vector.Unboxed as VU
setupEnv = pure $ replicate 1000000 (1 :: Double)
@Nnwww
Nnwww / Lib.hs
Last active May 29, 2017 03:22
nDCG in Haskell. Additionally, I draw graphs and serialize to csv (using Chart and Cassava).
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE DeriveGeneric #-}
module Lib
( writeNDCGs
, serializeNDCG
) where
import Data.List
import Graphics.Rendering.Chart.Easy
import Graphics.Rendering.Chart.Backend.Diagrams
import Control.Lens
def padding(char, num, padc='_'):
padcs = padc * num
return padcs + char + padcs
def draw(stack, n, i):
if n < 1:
return stack
num = 2 ** (n - 1)
char = str(num)
@Nnwww
Nnwww / Establish_server_using_Lwt.ml
Last active February 27, 2016 15:44
I picked up this snippet when netsurfing.
let () =
let sockaddr = Unix.ADDR_INET (Unix.inet_addr_of_string "0.0.0.0", 3333) in
let _server =
Lwt_io.establish_server sockaddr (fun (in_, out) ->
Lwt.catch (fun () ->
in_
|> Lwt_io.read_lines
|> Lwt_stream.iter_s (fun line -> Lwt_io.write_line out line)
) (fun _exn -> Lwt.return_unit (* callback shouldn't raise *))
|> Lwt.ignore_result
@Nnwww
Nnwww / Dining_philosophers.rs
Created February 11, 2016 15:11
フォークの奪い合いの様子を可視化
// Dining Philosophers
use std::thread;
use std::time::Duration;
use std::sync::{Arc, Mutex};
struct Table {
forks: Vec<Mutex<()>>,
}
struct Philosopher {
@Nnwww
Nnwww / racer_deoplete.md
Last active February 9, 2016 08:56
messages_racer_deoplete

環境

  • Mac OS X 10.10.5

  • NVIM 0.1.1 (compiled Jan 28 2016 12:13:02)

  • MacVim-KaoriYa 20160205

  • 各種プラグイン更新済み

    • racerの再インストール
    • NeobundleUpdate
      • deoplete, neocomplete, vim-racer, rust.vim
    • Rustのsrcをgit pull