Skip to content

Instantly share code, notes, and snippets.

@cobodo
cobodo / mozc_dvorak_tsuki2-263.txt
Last active April 17, 2024 15:20
中指前置シフト新JIS月配列2-263式かな入力を、Dvorakキーボード上のGoogleIME(mozc)で再現するための、GoogleIMEローマ字テーブルです。 https://gist.githack.com/cobodo/2a024bd79380226621dbd6a745aaa755/raw/72f06117e0e79f7cca1e851b926e8d3d0bdadf71/table.html
' そ
, こ
. し
p て
y ょ
f つ
g ん
c い
r の
l り
@cobodo
cobodo / wezterm.lua
Created March 13, 2023 06:14
~/.config/wezterm/wezterm.lua
local wezterm = require 'wezterm';
return {
font = wezterm.font("HackGen35 Console"),
font_size = 15,
font_hinting = None,
keys = {
{ key = "j", mods = "CTRL|SHIFT", action = wezterm.action.Nop },
{ key = ";", mods = "CTRL|SHIFT", action = wezterm.action.Nop },
{ key = "=", mods = "CMD", action = wezterm.action.IncreaseFontSize },
@cobodo
cobodo / local_search.rb
Last active February 12, 2019 05:54
mikutterがTLに持っているメッセージ全体から検索するプラグイン
# https://dev.mikutter.hachune.net/issues/1309 の、core/plugin/gui/timeline.rb へのパッチが必要。
# Usage: Plugin.call(:local_search, ":don:")
Plugin.create(:local_search) do
on_local_search do |keyword|
ms = Plugin::GUI::Timeline.cuscaded.values.flat_map {|tl| tl.to_a }.uniq {|m| m.uri }
found = ms.select {|m| m.description.include? keyword }
Plugin.call(:open_smartthread, found)
end
# commandもあるとよいね
@cobodo
cobodo / mikutter.log
Created January 28, 2019 08:30
同じはずなのに2つのTLで異なる内容のPlugin::Twitter::Messageが表示されているような状態が発生した直後にこれで落ちた
ArgumentError invalid byte sequence in UTF-8
{MIKUTTER_DIR}/core/utils.rb:410:in `split'
{MIKUTTER_DIR}/core/utils.rb:410:in `get_index_from_byte'
{MIKUTTER_DIR}/core/mui/cairo_miracle_painter.rb:295:in `main_pos_to_index_forclick'
{MIKUTTER_DIR}/core/lib/uithreadonly.rb:22:in `block (2 levels) in singleton class'
{MIKUTTER_DIR}/core/mui/cairo_miracle_painter.rb:185:in `point_moved'
{MIKUTTER_DIR}/core/lib/uithreadonly.rb:22:in `block (2 levels) in singleton class'
{MIKUTTER_DIR}/core/mui/cairo_cell_renderer_message.rb:184:in `block in event_hooks'
{MIKUTTER_DIR}/core/mui/gtk_extension.rb:35:in `block in safety_signal_connect'
{MIKUTTER_DIR}/core/mui/cairo_cell_renderer_message.rb:73:in `signal_emit'
@cobodo
cobodo / mikutter.log
Created January 17, 2019 07:08
なにもしてないのにこわれた
ArgumentError string contains null byte
{MIKUTTER_DIR}/vendor/bundle/ruby/2.6.0/gems/gobject-introspection-3.3.0/lib/gobject-introspection/loader.rb:587:in `invoke'
{MIKUTTER_DIR}/vendor/bundle/ruby/2.6.0/gems/gobject-introspection-3.3.0/lib/gobject-introspection/loader.rb:587:in `block in define_method'
{MIKUTTER_DIR}/vendor/bundle/ruby/2.6.0/gems/pango-3.3.0/lib/pango/layout.rb:31:in `set_text'
{MIKUTTER_DIR}/core/mui/cairo_sub_parts_message_base.rb:340:in `main_message'
{MIKUTTER_DIR}/core/lib/uithreadonly.rb:22:in `block (2 levels) in singleton class'
{MIKUTTER_DIR}/core/mui/cairo_sub_parts_message_base.rb:263:in `main_message_height'
{MIKUTTER_DIR}/core/lib/uithreadonly.rb:22:in `block (2 levels) in singleton class'
{MIKUTTER_DIR}/core/mui/cairo_sub_parts_message_base.rb:260:in `message_height'
{MIKUTTER_DIR}/core/lib/uithreadonly.rb:22:in `block (2 levels) in singleton class'
@cobodo
cobodo / mikutter.log
Created November 7, 2018 07:24
ショートカットキーの「追加」で落ちる
NoMethodError undefined method `messages' for nil:NilClass
{MIKUTTER_DIR}/core/plugin/command/command.rb:135:in `block (2 levels) in <top (required)>'
{MIKUTTER_DIR}/core/plugin/shortcutkey/shortcutkey_listview.rb:196:in `block in initialize'
{MIKUTTER_DIR}/core/plugin/shortcutkey/shortcutkey_listview.rb:187:in `each'
{MIKUTTER_DIR}/core/plugin/shortcutkey/shortcutkey_listview.rb:187:in `map'
{MIKUTTER_DIR}/core/plugin/shortcutkey/shortcutkey_listview.rb:187:in `initialize'
{MIKUTTER_DIR}/core/plugin/shortcutkey/shortcutkey_listview.rb:139:in `new'
{MIKUTTER_DIR}/core/plugin/shortcutkey/shortcutkey_listview.rb:139:in `command_box'
{MIKUTTER_DIR}/core/plugin/shortcutkey/shortcutkey_listview.rb:105:in `popup_input_window'
{MIKUTTER_DIR}/core/mui/gtk_crud.rb:154:in `record_create'
@cobodo
cobodo / tl_scan.rb
Created November 6, 2018 05:39
tl_slugに含まれるメッセージのうちdescriptionにfooを含むものを探してその位置までスクロールするmikutterコンソールスニペット
tl_slug = :extract_1234567890
keyword = 'foo'
inner_tl = Plugin[:gtk].widgetof(Plugin::GUI::Timeline.cuscaded[tl_slug])
target_path = nil
inner_tl.model.each do |model, path, iter|
desc = iter[Gtk::TimeLine::InnerTL::MESSAGE].description
if desc.scan(keyword).size > 0
target_path = path
break
Plugin.create(:photo_support) do
amazon_json_regex = %r!'colorImages': { 'initial': (\[.*MAIN.*\])!.freeze
defimageopener('Amazon', %r<\Ahttps?://www\.amazon\.(?:co\.jp|com)/(?:.*/)?(?:dp/|gp/product/)[0-9A-Za-z_]+>) do |url|
html = HTTPClient.new.get_content(url, [], [['User-Agent', 'mikutter']])
m = amazon_json_regex.match(html)
next nil unless m
arr = JSON.parse(m[1], symbolize_names: true)
main = arr.find {|v| v[:variant] == "MAIN" }
open(main[:large]) # :hiRes, :thumb, :large, :lowRes (all variations might be nullable). :main is an array containing other variations of [{url => [width, height]}]
end
@cobodo
cobodo / extract_load_more.rb
Last active December 12, 2018 17:48
load more機能mikutter風 ~https://github.com/cobodo/mikutter-worldon/tree/load_more を添えて~
Plugin.create(:extract_load_more) do
def tl_uris
@tl_uris ||= Hash.new # timeline_slug -> datasource_slug -> URI -> time
end
tl_uris
def extract_tabs
Plugin[:extract].extract_tabs
end
@cobodo
cobodo / timeline_dam.rb
Last active November 9, 2018 10:14
スクロール位置が一定値より下なら、古いメッセージを消さないようにするmikutterプラグイン。
Plugin.create(:timeline_dam) do
UserConfig[:timeline_dam_criteria] ||= 80
unless Gtk::TimeLine.method_defined?(:timeline_dam_original_add)
class Gtk::TimeLine
alias :timeline_dam_original_add :_add
def _add(message)
@timeline_max ||= UserConfig[:timeline_max]
criteria = UserConfig[:timeline_dam_criteria] / 100.0
if @tl.vadjustment.value < criteria