Skip to content

Instantly share code, notes, and snippets.

Yuki pasela

  • Japan
Block or report user

Report or block pasela

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@pasela
pasela / go-http-echo.go
Created Apr 4, 2018
Simple HTTP echo server written in Go.
View go-http-echo.go
// Simple HTTP echo server written in Go.
package main
import (
"bytes"
"context"
"flag"
"io"
"io/ioutil"
"log"
@pasela
pasela / go-http-proxy.go
Created Apr 4, 2018
Simple HTTP proxy server written in Go.
View go-http-proxy.go
// Simple HTTP proxy server written in Go.
package main
import (
"context"
"flag"
"fmt"
"log"
"net/http"
"net/http/httputil"
@pasela
pasela / .bash_profile
Last active May 10, 2016
[shell] interactive file selection and interactive change directory
View .bash_profile
# specify your favorite filtering tool
if [[ -z "$INTERACTIVE_SELECTOR" ]]; then
if type fzy >/dev/null 2>&1; then
export INTERACTIVE_SELECTOR=fzy
elif type peco >/dev/null 2>&1; then
export INTERACTIVE_SELECTOR=peco
elif type fzf >/dev/null 2>&1; then
export INTERACTIVE_SELECTOR=fzf
fi
fi
View .vimrc-dein
set nocompatible
let s:dein_root = expand('~/.vim/dein')
let s:dein_path = expand(s:dein_root . '/repos/github.com/Shougo/dein.vim')
execute 'set runtimepath^=' . s:dein_path
call dein#begin(s:dein_root)
call dein#add('Shougo/dein.vim')
call dein#add('Shougo/vimproc.vim', {
\ 'build': 'make'
@pasela
pasela / parse_bool.rb
Created Aug 21, 2015
[ruby] parse_bool.rb
View parse_bool.rb
# encoding: utf-8
# 論理値に変換する
#
# falseとなる値
# nil, false, 0
# falseとなる文字列(大文字小文字区別なし)
# 0, 0.0, f, false, n, no, off, 空文字, 空白文字のみ
# trueとなるもの
# 上記以外
View expand-tilde.go
import (
"os/user"
"strings"
)
func ExpandTilde(path string) (string, error) {
if path[0] != '~' {
return path, nil
}
@pasela
pasela / md2html.rb
Created Mar 24, 2014
[ruby] Markdown to HTML converter CLI
View md2html.rb
# encoding: utf-8
require "optparse"
require "redcarpet"
class HTMLWithSyntaxHighlighter < Redcarpet::Render::HTML
ESCAPE_HTML_TABLE = {
"'" => '&#39;',
'&' => '&amp;',
'"' => '&quot;',
@pasela
pasela / pencil256.vim
Created Mar 17, 2014
[vim] Vim Color Scheme: pencil256.vim is a derived version of pencil.vim. pencil256 supports terminal-based Vim without pencil color scheme for the terminal. (Original pencil.vim requires it such as iterm-colors-pencil)
View pencil256.vim
" Vim Color File
"
" pencil256.vim is a derived version of pencil.vim. pencil256 supports
" terminal-based Vim without pencil color scheme for the terminal.
" (Original pencil.vim requires it such as iterm-colors-pencil)
"
" In terminal-based Vim, pencil256 has a little difference of colors, because
" pencil256 uses the default palette of the terminal (such as xterm 256 color).
"
" Name: pencil256.vim
@pasela
pasela / capture3_with_timeout.rb
Last active Sep 26, 2019
[ruby] capture3_with_timeout
View capture3_with_timeout.rb
# encoding: utf-8
require "timeout"
# Capture the standard output and the standard error of a command.
# Almost same as Open3.capture3 method except for timeout handling and return value.
# See Open3.capture3.
#
# result = capture3_with_timeout([env,] cmd... [, opts])
#
@pasela
pasela / rqrcode_ja.rb
Last active May 22, 2017
[ruby] rQRCode Japanese string
View rqrcode_ja.rb
# encoding: utf-8
require 'rqrcode'
require 'rqrcode_png'
str = '日本語てすと'
# QRコードで日本語を扱う場合はShift_JISが一般的
# 加えてライブラリの問題なのかASCII-8BITで渡さないとうまくいかない
qr_str = str.encode('CP932')
You can’t perform that action at this time.