Skip to content

Instantly share code, notes, and snippets.

@osyoyu
osyoyu / checkpacman.zsh
Created July 31, 2012 07:52
CheckPacman
#!/bin/zsh
# add the line under to your zshrc:
# source checkpacman.zsh
rnd=$(( (RANDOM % 5) ))
if [ $rnd -ne 0 ]; then
return
else
echo "Checking the time of last update..."
@osyoyu
osyoyu / setup-httpd242.sh
Created August 1, 2012 14:56
Apache 2.4.2 Install Script
#!/bin/sh
if [ ! `id -u` -eq 0 ]; then
echo "You must run this script as root"
exit
fi
BASE_PATH=`pwd`
if [ ! -d "httpd-2.4.2" ]; then
@osyoyu
osyoyu / ruby.vim
Created August 21, 2012 15:03
ftplugin/ruby.vim
" Replace 2 space-indents to tabs on open
" and switch them back on close
function SpacesToTabs()
set ts=4
set sw=4
set sts=0
set noexpandtab
@osyoyu
osyoyu / monacoin_rpc.rb
Created January 21, 2014 06:26
Bitcoin JSON-RPC sample fails to connect to monacoind (?) https://en.bitcoin.it/wiki/API_reference_%28JSON-RPC%29#Ruby
require 'net/http'
require 'uri'
require 'json'
class BitcoinRPC
def initialize(service_url)
@uri = URI.parse(service_url)
end
def method_missing(name, *args)
Ansi 0 Color (Black)
79, 79, 79
#4f4f4f
Ansi 1 Color (Blue)
96, 108, 255
#606cff
Ansi 2 Color (Green)
96, 255, 168
ANSI Color 0 (Black)
#626262
ANSI Color 1 (Red)
#F18071
ANSI Color 2 (Green)
#B2F472
ANSI Color 3 (Brown/Yellow)
@osyoyu
osyoyu / 99-evdev-trackpoint.conf
Last active August 29, 2015 14:04
ThinkPad X240 ClickPad Configuration
Section "InputClass"
Identifier "Clickpad"
MatchIsTouchpad "on"
MatchDevicePath "/dev/input/event*"
Driver "evdev"
# RightButtonAreaLeft RightButtonAreaRight RightButtonAreaTop RightButtonAreaBottom MiddleButtonAreaLeft MiddleButtonAreaRight MiddleButtonAreaTop MiddleButtonAreaBottom
Option "SoftButtonAreas" "66% 0 0 0 50% 64% 0 0"
# Disable tapping and scrolling
@osyoyu
osyoyu / trackpoint.rules
Created July 16, 2014 12:24
ThinkPad X240 TrackPoint Configuration
SUBSYSTEM=="serio", DRIVERS=="psmouse", WAIT_FOR="/sys/devices/platform/i8042/serio1/serio2/sensitivity", ATTR{sensitivity}="175", ATTR{speed}=100"
@osyoyu
osyoyu / camel.rb
Created November 4, 2014 04:55
らくだメソッド
# coding: UTF-8
# 山を確認するためだけのメソッド
def show_array(array)
array.each {|e|
puts "#{e}: #{"***" * e}"
}
end
def camelize(target, bump_count)
@osyoyu
osyoyu / klis.rb
Last active August 29, 2015 14:08
klisの課題(やっつけ)
# coding: UTF-8
def font_size(rank, max)
rate = rank.to_f / max
if rate > 6.to_f / 7
return 7
elsif rate > 5.to_f / 7
return 6
elsif rate > 4.to_f / 7