Skip to content

Instantly share code, notes, and snippets.

View tobynet's full-sized avatar

tobynet tobynet

  • Toyama, Japan
View GitHub Profile
@tobynet
tobynet / tw-length.rb
Created August 8, 2013 01:40
TwLength: Irresponsible message length calculator for posting twitter
#!/usr/bin/env ruby
# -*- coding: utf-8 -*-
# Implements
module TwLength
# ref. https://dev.twitter.com/docs/api/1.1/get/help/configuration
# Someone help me with getting twitter configuration without oAuth? ;(
#
# RESERVED_LENGTH.must_eqal [short_url_length_http, short_url_length_https].max
MAX_RESERVED_LENGTH = 23
@tobynet
tobynet / add-separator-each-commands.zsh
Created June 7, 2013 13:35
Add separating line between commands on zsh. zshでコマンドを実行したら、次のプロンプトの前に区切り線を出して、コマンドとコマンドの間を見易くするやつ。~/.zshrcなどにコピペして使う。
# Add separating line between commands
# cf. oh-my-zsh af-magic theme https://github.com/robbyrussell/oh-my-zsh/blob/master/themes/af-magic.zsh-theme
if [[ ! ( $PROMPT =~ '-----------------------------------------' ) ]]; then
PROMPT='$FG[237]------------------------------------------------------------%{$reset_color%}
'"$PROMPT"
fi
@tobynet
tobynet / suppress_ctrl-q_on_ubuntu-12.04desktop.sh
Last active December 11, 2015 20:18
Suppress unintentionally closing application by Ctrl+Q on Ubuntu 12.04 desktop.
#!/bin/bash
# 概要: Ubuntu 12.04 デスクトップ上で、Ctrl+Qにて意図せずアプリケーションが終了されてしまうのを防ぐ
# 必要: $ sudo apt-get install gconf2
# 確認方法: $ gconftool-2 -a /desktop/gnome/keybindings/$KEYBINDING_KEY
# 注意点: 誤ってキーが押されたら notify-send で通知しているので、邪魔なら外してください
KEYBINDING_KEY=custom100
if [[ -z "$(gconftool-2 -a /desktop/gnome/keybindings/$KEYBINDING_KEY)" ]] ; then
gconftool-2 --set --type string /desktop/gnome/keybindings/$KEYBINDING_KEY/name 'unintentionally Ctrl+Q killer'
@tobynet
tobynet / cakesgetter.py
Last active December 11, 2015 06:48 — forked from laiso/cakesgetter.py
ツイッター検索からcakes無料時間の記事を探してダウンロードしておくスクリプト
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
cakegetter.py
ツイッター検索からcakes無料時間の記事を探してダウンロードしておくスクリプト
"""
import os
import re
#!/usr/bin/env python
# An `ad-hoc` script to change user interface language
# for Anki2 on Ubuntu 12.04 desktop.
# Usage: anki2-change-defaultLang-to-en.py [lang]
#
# Examples:
# # Change to english interface
# $ anki2-change-defaultLang-to-en.py en
@tobynet
tobynet / dankai_words.txt
Created December 17, 2012 11:03
団塊世代ワードをゲットする便利スクリプトです. A fetcher of words by the japanese babyboomers.
「ナウい」
「ハレンチ」
「アジャパー」
「やったぜベイビー」
「はっ!!あと一組なのに!?」
「三年目の補講」
「キレる中高年」
「今の良くない日本」
「はいはい分かりましたよ。もうちょっと待ちますよ」
「うるさいなあ。お前が病院行けよ!」
@tobynet
tobynet / health-check-list.mkd
Created November 24, 2012 12:56
check list of health

体調が悪い時の兆候チェックリスト

  • パソコンの液晶(24inch以上)を利用していて、
    • 画面が妙に明るく感じる とき
    • 黒主体のウェブサイトを見た後で白いサイトを見ると気持ち悪くなる とき
  • 他人の言動が自分のことを対象にしているかのように感じる とき
    • ❏(自覚がある場合は、単にダメージをうけたように感じる)
    • ❏極寒の中に裸でいるような気分である時
  • 頭がすっきりしていない とき
  • 判断力が落ちている と自覚しているとき
@tobynet
tobynet / gist:3666491
Created September 7, 2012 14:02
a part of vimrc for ruby bundler with vim-quickrun
" vim-quickrunで ruby の bundler を考慮する
augroup quickrun_ruby_config
autocmd!
autocmd FileType ruby call s:quickrun_ruby_config()
augroup END
function! s:quickrun_ruby_config()
" detect "bundler" by checking "Gemfile" from upper directory of current file
let execs = executable('bundle') &&
\ findfile('Gemfile', '.;') != '' ? 'bundle exec ' : ''
@tobynet
tobynet / erokimos.rb
Created August 29, 2012 08:46
erokimos text-converter CLI
#!/usr/bin/env ruby
# -*- coding: utf-8 -*-
program = File.basename($PROGRAM_NAME)
USAGE = <<EOD
usage: #{program} text
example:
$ #{program} "みんなでワイワイ バーベキューなう"
たわわに実るみんなでワイワイ 甘美なバーベキューなう
or
@tobynet
tobynet / shindan.rb
Created July 27, 2012 13:32
do shindan
#!/usr/bin/env ruby
# -*- coding: utf-8 -*-
#
# usage:
# shindan.rb [id] [name]
#
# example:
# $ shindan.rb 152454 お魚日
# オオオオオョヒーオギ