Skip to content

Instantly share code, notes, and snippets.

@tmtm
tmtm / key_event.rb
Last active December 28, 2021 03:08
キーイベントを表示する
View key_event.rb
# キーイベントを表示する
EV_KEY = 1
EVIOCGRAB = 1074021776
key_code = {}
IO.readlines('/usr/include/linux/input-event-codes.h').each do |line|
if line.sub(/\/\*.*/, '') =~ /#define\s(KEY_\w+)+\s+(.+)(\/\*.*)?$/
key, code = $1, $2
eval("#{key} = #{code}")
@tmtm
tmtm / auto_input_key.rb
Last active December 28, 2021 01:56
自動的に 0〜9 キーを入力する
View auto_input_key.rb
# 自動的に 0〜9 キーを入力する
UI_SET_EVBIT = 1074025828
UI_SET_KEYBIT = 1074025829
UI_DEV_SETUP = 1079792899
UI_DEV_CREATE = 21761
EV_KEY = 1
EV_SYN = 0
SYN_REPORT = 0
@tmtm
tmtm / win_class_title.rb
Created December 26, 2021 16:47
X のウィンドウのクラスとタイトルを取得する
View win_class_title.rb
require 'ffi'
module FFI
typedef :pointer, :Display
typedef :ulong, :XID
typedef :XID, :Window
typedef :int, :Status
typedef :ulong, :Atom
end
@tmtm
tmtm / gemdiff.sh
Created November 14, 2021 09:11
gem の差分を見る
View gemdiff.sh
#!/bin/bash
dir1=$(mktemp -d)
dir2=$(mktemp -d)
trap "rm -rf $dir1 $dir2" EXIT
cat $1 | (cd $dir1 && tar xf - && tar xf data.tar.gz && gunzip metadata.gz checksums.yaml.gz)
cat $2 | (cd $dir2 && tar xf - && tar xf data.tar.gz && gunzip metadata.gz checksums.yaml.gz)
diff --color=auto -ur $dir1 $dir2
@tmtm
tmtm / nhk+_toggle_controller.js
Last active December 30, 2020 05:13
NHK+のコントローラー表示をトグルするブックマークレット
View nhk+_toggle_controller.js
javascript:(function(){var e=document.querySelector('.hls-player_controller'); if(e.style.display=='none'){e.style.display=''}else{e.style.display='none'}})();
@tmtm
tmtm / romantable.txt
Created October 8, 2019 14:46
ローマ字変換テーブル
View romantable.txt
z1 ○
z! ●
z2 ▽
z@ ▼
z3 △
z# ▲
z4 □
z$ ■
z5 ◇
z% ◆
@tmtm
tmtm / sjis-cp932-diff.txt
Last active April 24, 2020 05:30
MySQLのsjisとcp932で異なる文字
View sjis-cp932-diff.txt
+------+------+-------+
| code | sjis | cp932 |
+------+------+-------+
| 815F | \ | \ |
| 8160 | 〜 | ~ |
| 8161 | ‖ | ∥ |
| 817C | − | - |
| 8191 | ¢ | ¢ |
| 8192 | £ | £ |
| 81CA | ¬ | ¬ |
@tmtm
tmtm / trackpoint.sh
Created November 18, 2016 16:19
trackpointの速度を調整して、トラックパッドを無効にする
View trackpoint.sh
#!/bin/bash
DIR=/sys/devices/platform/i8042
SPEED=200
SENSITIVITY=200
modprobe -r psmouse
modprobe psmouse proto=any
while :; do
until [ -f $DIR/serio*/serio*/speed -a -f $DIR/serio*/serio*/sensitivity ]; do
sleep 1
View gist:1478ea9a80cbf8cb8457605f092f17f2
'(riece-default-coding-system (quote (utf-8 . utf-8)))
'(riece-default-freeze t)
'(riece-keywords (quote ("hoge" "fuga")))
'(riece-log-coding-system (quote utf-8))
'(riece-server "localhost")
'(riece-startup-channel-list (quote ("#a" "#hoge" "#tmtms" "#hogehoge")))
;; riece
@tmtm
tmtm / gist:a569753ecb5f33640fe6
Created January 30, 2015 01:31
Windows の Rabbit で PDF を表示しようとしたときに出たエラー
View gist:a569753ecb5f33640fe6
DL is deprecated, please use Fiddle
c:/Ruby21/lib/ruby/gems/2.1.0/gems/rabbit-2.1.3/lib/rabbit/parser/pdf.rb: line 29
Poppler-INFO **:Syntax error at position -1: Couldn't find trailer dictionary
c:/Ruby21/lib/ruby/gems/2.1.0/gems/rabbit-2.1.3/lib/rabbit/parser/pdf.rb: line 29
Poppler-INFO **:Syntax error at position -1: Couldn't find trailer dictionary
c:/Ruby21/lib/ruby/gems/2.1.0/gems/rabbit-2.1.3/lib/rabbit/parser/pdf.rb: line 29
Poppler-INFO **:Syntax error at position -1: Couldn't read xref table
c:/Ruby21/lib/ruby/gems/2.1.0/gems/rabbit-2.1.3/lib/rabbit/parser/pdf.rb:29:in `initialize': PDF document is damaged (GLib::Error)
from c:/Ruby21/lib/ruby/gems/2.1.0/gems/rabbit-2.1.3/lib/rabbit/parser/pdf.rb:29:in `new'
from c:/Ruby21/lib/ruby/gems/2.1.0/gems/rabbit-2.1.3/lib/rabbit/parser/pdf.rb:29:in `parse'