Skip to content

Instantly share code, notes, and snippets.

Avatar
😪

Shimpei Makimoto makimoto

😪
View GitHub Profile
View extract_5chars.rb
# 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/
View gist:a952f0a05d95aacec3e4c79804c6d368
[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
View bundler_profiler.rb
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
View animegif.sh
#! /bin/sh
open https://www.tumblr.com/search/gif+`ruby -r uri -e "print URI.escape '$@'"`
View rot13.rb
def rot13(str)
str.tr("a-zA-Z", "n-za-mN-ZA-M")
end
ARGF.each do |line|
puts rot13(line)
end
View log.txt
Using worker: worker-linux-5-1.bb.travis-ci.org:travis-linux-10
Applying updates
travis_fold:start:git.1
$ git clone --depth=50 --branch=master git://github.com/ruby/www.ruby-lang.org.git ruby/www.ruby-lang.org
Cloning into 'ruby/www.ruby-lang.org'...
remote: Counting objects: 3196, done.
remote: Compressing objects: 0% (1/2145) 
remote: Compressing objects: 1% (22/2145) 
remote: Compressing objects: 2% (43/2145) 
View ねむい.rb
~ 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]]],
View wg4y100.user.js
// ==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='