Skip to content

Instantly share code, notes, and snippets.

View pasela's full-sized avatar

Yuki pasela

  • Japan
View GitHub Profile
@pasela
pasela / private.xml
Created September 3, 2013 06:22
[KeyRemap4MacBook] LeaveInsMode with EISUU(vim keybind apps)
<?xml version="1.0"?>
<root>
<symbol_map type="KeyCode" name="[" value="0x1e" />
<appdef>
<appname>iTERM2</appname>
<equal>com.googlecode.iterm2</equal>
</appdef>
<list>
<item>
<name>LeaveInsMode with EISUU(vim keybind apps)</name>
@pasela
pasela / Pinky_terminal.png
Last active December 22, 2015 11:09
A Pinky color theme for iTerm2 and Terminal.app
Pinky_terminal.png
@pasela
pasela / git-su
Last active January 17, 2023 13:05
git-su - switches user and sshCommand in the current repository
#!/bin/bash
#
# git-su - Git Switch User
# ========================
#
# git-su switches user and sshCommand in the current repository.
#
# USAGE
# -----
#
@pasela
pasela / fizzbuzz.html
Created November 3, 2013 18:05
FizzBuzz with Twitter Bootstrap pagination.
<!DOCTYPE HTML>
<html lang="ja">
<head>
<meta charset="UTF-8">
<title>FizzBuzz</title>
<link rel="stylesheet" href="https://netdna.bootstrapcdn.com/twitter-bootstrap/2.0.4/css/bootstrap-combined.min.css" />
<style>
h1 {
@pasela
pasela / pre-commit
Last active December 27, 2015 10:39
[git] Prevent commits from default user.
#!/bin/sh
git config user.name >/dev/null && git config user.email >/dev/null
if [ $? -ne 0 ]; then
cat <<EOF
Error: Attempt to commit by default user.
$GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL>
Please set user.name and user.email using following commands.
@pasela
pasela / git-fix-author-committer
Last active May 14, 2021 19:40
git-fix-author-committer - Apply filter-branch --commit-filter easily
#!/bin/bash
#
# Apply filter-branch --commit-filter easily
#
# Author: Yuki <[email protected]>
# License: MIT License
#
PROGNAME=$(basename $0)
SUBCMDNAME=${PROGNAME#git-}
@pasela
pasela / download_latest_minecraft_server.sh
Created December 12, 2013 15:54
Download latest minecraft_server.jar
#!/bin/bash
DOWNLOAD_PAGE=https://minecraft.net/download
url=$(curl -Ss "$DOWNLOAD_PAGE" | grep -ohE 'http.[^"]+/minecraft_server\.[^"]+\.jar')
if [[ -n "$url" ]]; then
curl -O "$url"
fi
@pasela
pasela / rqrcode_ja.rb
Last active May 22, 2017 07:20
[ruby] rQRCode Japanese string
# encoding: utf-8
require 'rqrcode'
require 'rqrcode_png'
str = '日本語てすと'
# QRコードで日本語を扱う場合はShift_JISが一般的
# 加えてライブラリの問題なのかASCII-8BITで渡さないとうまくいかない
qr_str = str.encode('CP932')
@pasela
pasela / capture3_with_timeout.rb
Last active October 18, 2023 18:33
[ruby] capture3_with_timeout
# 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 / pencil256.vim
Created March 17, 2014 08:55
[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)
" 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