Skip to content

Instantly share code, notes, and snippets.

View makimoto's full-sized avatar
😪

Shimpei Makimoto makimoto

😪
View GitHub Profile

Keybase proof

I hereby claim:

  • I am makimoto on github.
  • I am makimoto (https://keybase.io/makimoto) on keybase.
  • I have a public key ASB9yD6QsXwfTx6UY0TwXmJ_IpUgkKmp_bHuuDQTnKx7eQo

To claim this, I am signing this object:

# extract_5chars.rb
# extract effective 5-character words for the initial word of Wordle.
#
# Written by: Shimpei Makimoto
# License: MIT License https://makimoto.mit-license.org/
#
# usage: ruby extract_5chars.rb <input_file>
# The input_file is a list of words that are separated by newline.
# such as: https://github.com/tabatkins/wordle-list/blob/main/words
# https://dumps.wikimedia.org/enwiktionary/
@makimoto
makimoto / removeWikipediaNotice.user.js
Created November 23, 2011 16:04
a user script to remove Wikipedia's donation notice
// ==UserScript==
// @name Remove Wikipedia Notice
// @namespace http://makimoto.tsuyabu.in
// @include http://*.wikipedia.org/*
// ==/UserScript==
document.getElementById('siteNotice').style.display = 'none'
@makimoto
makimoto / rhg-mobi.rb
Last active August 30, 2018 12:16 — forked from miyagawa/rhg-mobi.rb
#!/usr/bin/env ruby
file = File.open("index.html", "r:iso-2022-jp:UTF-8")
content = file.read
all_html = <<HTML
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<meta name="Author" content="Aoki Minero">
[bundler|tags/v1.16.1]% stackprof out.dump --limit 100
==================================
Mode: cpu(1000)
Samples: 21403 (6.89% miss rate)
GC: 2649 (12.38%)
==================================
TOTAL (pct) SAMPLES (pct) FRAME
5838 (27.3%) 5838 (27.3%) Gem::Package#realpath
2649 (12.4%) 2649 (12.4%) (garbage collection)
11253 (52.6%) 1873 (8.8%) Gem::Package#extract_tar_gz
require 'stackprof'
require 'tmpdir'
$LOAD_PATH.unshift('./lib')
require 'bundler'
StackProf.run(mode: :cpu, raw: true, out: 'out.dump') do
bundler_gemspec = Gem::Specification.load(File.expand_path("./bundler.gemspec"))
bundler_gemspec.instance_variable_set(:@full_gem_path, File.expand_path("."))
bundler_gemspec.activate if bundler_gemspec.respond_to?(:activate)
1.times do
➜ ~ pry -rripper
[1] pry(main)> Ripper.sexp("a")
=> [:program, [[:vcall, [:@ident, "a", [1, 0]]]]]
[2] pry(main)> Ripper.sexp("b = 1")
=> [:program,
[[:assign, [:var_field, [:@ident, "b", [1, 0]]], [:@int, "1", [1, 4]]]]]
[3] pry(main)> Ripper.sexp("c ||= 1")
=> [:program,
[[:opassign,
[:var_field, [:@ident, "c", [1, 0]]],
// ==UserScript==
// @name W and G for Y!100
// @namespace http://d.hatena.ne.jp/makimoto/
// @description Making links to Wikipedia (ja) and Google Search in Yahoo! Hyakka-jiten (Encyclopedia)
// @include http://100.yahoo.co.jp/*
// @require http://jqueryjs.googlecode.com/files/jquery-1.2.6.js
// ==/UserScript==
jQuery(function(){
w = 'http://ja.wikipedia.org/w/index.php?title=%E7%89%B9%E5%88%A5%3A%E6%A4%9C%E7%B4%A2&ns0=1&search='
G = 'http://www.google.co.jp/search?q='
#0 0x00007ffff6d248a5 in raise () from /lib64/libc.so.6
#1 0x00007ffff6d26085 in abort () from /lib64/libc.so.6
#2 0x00007ffff7f3783b in rb_bug (fmt=0x7ffff7f6ff97 "Segmentation fault") at error.c:309
#3 0x00007ffff7e698fb in sigsegv (sig=11, info=0x7ffff8291bf0, ctx=0x7ffff8291ac0) at signal.c:649
#4 <signal handler called>
#5 0x00007ffff7dc348d in gc_mark_children (objspace=0x7ffff8227980, ptr=140737420111120) at gc.c:2835
#6 0x00007ffff7dc3716 in gc_mark_stacked_objects (objspace=0x7ffff8227980) at gc.c:2904
#7 0x00007ffff7dc3890 in gc_marks (objspace=0x7ffff8227980) at gc.c:2949
#8 0x00007ffff7dc3b94 in garbage_collect (objspace=0x7ffff8227980) at gc.c:3038
#9 0x00007ffff7dc3c23 in garbage_collect_with_gvl (objspace=0x7ffff8227980) at gc.c:3060