Skip to content

Instantly share code, notes, and snippets.

View pasela's full-sized avatar

Yuki pasela

  • Japan
View GitHub Profile
@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 / 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 / .vimrc-dein
Created March 11, 2016 08:27
.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 / .bash_profile
Last active May 10, 2016 11:13
[shell] interactive file selection and interactive change directory
# 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
@pasela
pasela / screen-4.1.0-cygwin-sock-permission.patch
Created August 20, 2012 05:40
GNU screen: A patch to avoid /tmp/uscreens permission check on Cygwin
diff --git a/src/screen.c b/src/screen.c
index 6e19732..3a8ca3e 100644
--- a/src/screen.c
+++ b/src/screen.c
@@ -1102,8 +1102,10 @@ char **av;
n = (eff_uid == 0 && (real_uid || (st.st_mode & 0775) != 0775)) ? 0755 :
(eff_gid == (int)st.st_gid && eff_gid != real_gid) ? 0775 :
0777;
+#if !defined(__CYGWIN__)
if (((int)st.st_mode & 0777) != n)
@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 / go-http-echo.go
Created April 4, 2018 05:17
Simple HTTP echo server written in Go.
// Simple HTTP echo server written in Go.
package main
import (
"bytes"
"context"
"flag"
"io"
"io/ioutil"
"log"
@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 <paselan@gmail.com>
# License: MIT License
#
PROGNAME=$(basename $0)
SUBCMDNAME=${PROGNAME#git-}
@pasela
pasela / gist:6051206
Last active May 18, 2022 20:34
[alfred] Open ssh in iTerm (Alfred Workflow)
tell application "iTerm"
activate
tell the first terminal
set ssh_session to (make new session at end of sessions)
tell ssh_session
exec command "ssh {query}"
end tell
end tell
end tell