Skip to content

Instantly share code, notes, and snippets.

View nobu's full-sized avatar

Nobuyoshi Nakada nobu

  • Nihon Ruby-no-Kai
  • Kanuma, Tochigi, Japan
  • X @n0kada
View GitHub Profile
@nobu
nobu / gh-cancel-runs
Created May 12, 2023 05:56
Cancel GitHub Actions Workflows
#!/bin/bash
repo_arg=()
limit_arg=
list_args=()
sha_arg=
dryrun=
for arg; do
if test ${#repo_arg[@]} = 1; then
repo_arg=("${repo_arg[@]}" "$arg")
/* compile with -O2 */
#include <math.h>
#include <float.h>
#define value_finite(d) 'f'
#define value_infinity() 'i'
#define value_nan() 'n'
static int
check_value(double value)
module WithResources
def self.with(release_method: :close, &block)
vars = []
trace = TracePoint.new(:b_call) do |tp|
trace.disable
b = tp.binding
block.parameters.each do |_, name|
vars << [name, b.local_variable_get(name)]
end
end
2017-08-11 16:12:08.204 ruby-trunk[85918:35170956] *** WARNING: Method userSpaceScaleFactor in class NSView is deprecated on 10.7 and later. It should not be used in new applications. Use convertRectToBacking: instead.
(rabbit:85918): GLib-GIO-CRITICAL **: g_loadable_icon_load: assertion 'G_IS_LOADABLE_ICON (icon)' failed
Gtk-WARNING **: Error loading theme icon 'edit-find' for stock: アイコンの読み込みに失敗しました
from /opt/local/lib/ruby/gems/2.5.0/gems/rabbit-2.2.0/lib/rabbit/command/rabbit.rb:644:in `new'
from /opt/local/lib/ruby/gems/2.5.0/gems/rabbit-2.2.0/lib/rabbit/command/rabbit.rb:644:in `choose_source_file_by_dialog'
from /opt/local/lib/ruby/gems/2.5.0/gems/rabbit-2.2.0/lib/rabbit/command/rabbit.rb:671:in `make_source'
from /opt/local/lib/ruby/gems/2.5.0/gems/rabbit-2.2.0/lib/rabbit/command/rabbit.rb:849:in `do_display'
from /opt/local/lib/ruby/gems/2.5.0/gems/rabbit-2.2.0/lib/rabbit/command/rabbit.rb:61:in `block (2 levels) in run'
from /opt/local/lib/ruby/gems/2.5.0/gems/rabbit-2.2.0/lib/rabbit/command
2017-08-11 16:12:08.204 ruby-trunk[85918:35170956] *** WARNING: Method userSpaceScaleFactor in class NSView is deprecated on 10.7 and later. It should not be used in new applications. Use convertRectToBacking: instead.
(rabbit:85918): GLib-GIO-CRITICAL **: g_loadable_icon_load: assertion 'G_IS_LOADABLE_ICON (icon)' failed
Gtk-WARNING **: Error loading theme icon 'edit-find' for stock: アイコンの読み込みに失敗しました
from /opt/local/lib/ruby/gems/2.5.0/gems/rabbit-2.2.0/lib/rabbit/command/rabbit.rb:644:in `new'
from /opt/local/lib/ruby/gems/2.5.0/gems/rabbit-2.2.0/lib/rabbit/command/rabbit.rb:644:in `choose_source_file_by_dialog'
from /opt/local/lib/ruby/gems/2.5.0/gems/rabbit-2.2.0/lib/rabbit/command/rabbit.rb:671:in `make_source'
from /opt/local/lib/ruby/gems/2.5.0/gems/rabbit-2.2.0/lib/rabbit/command/rabbit.rb:849:in `do_display'
from /opt/local/lib/ruby/gems/2.5.0/gems/rabbit-2.2.0/lib/rabbit/command/rabbit.rb:61:in `block (2 levels) in run'
from /opt/local/lib/ruby/gems/2.5.0/gems/rabbit-2.2.0/lib/rabbit/command
[48/74] TestThread#test_thread_interrupt_for_killed_thread = 9.01 s
1) Failure:
TestThread#test_thread_interrupt_for_killed_thread [/Users/nobu/src/ruby/trunk/src/test/ruby/test_thread.rb:1203]:
[Bug #8996]
pid 3059 killed by SIGABRT (signal 6)Diagnostic reports:
| Process: ruby [3059]
| Path: /Users/USER/*/ruby
| Identifier: ruby
| Version: 0
| Code Type: X86-64 (Native)
0000000 50 4b 03 04 0a 00 00 00 00 00 68 68 85 4a 00 00 >PK........hh.J..<
0000020 00 00 00 00 00 00 00 00 00 00 1f 00 10 00 e5 90 >..............?.<
0000040 8d e7 a7 b0 e6 9c aa e8 a8 ad e5 ae 9a e3 83 95 >.称?.?設?.?..<
0000060 e3 82 a9 e3 83 ab e3 82 bf e3 82 99 2f 55 58 0c >?.??.??.??../UX.<
0000100 00 84 6c e4 58 84 6c e4 58 f5 01 14 00 50 4b 01 >..l?X.l?X?...PK.<
0000120 02 15 03 0a 00 00 00 00 00 68 68 85 4a 00 00 00 >.........hh.J...<
0000140 00 00 00 00 00 00 00 00 00 1f 00 0c 00 00 00 00 >................<
0000160 00 00 00 00 40 ed 41 00 00 00 00 e5 90 8d e7 a7 >....@?A....?..?<
0000200 b0 e6 9c aa e8 a8 ad e5 ae 9a e3 83 95 e3 82 a9 >??.?設?.?..?.?<
0000220 e3 83 ab e3 82 bf e3 82 99 2f 55 58 08 00 84 6c >?.??.??../UX...l<
#!/usr/local/bin/ruby
require 'open3'
require 'tempfile'
require 'rbconfig'
require 'fiddle/import'
class Sample
def main
func = RbConfig::CONFIG["SYMBOL_PREFIX"]+"sample_add"
src = <<EOS
@nobu
nobu / gist:3315f8e9f6073221e3311828b3bd9631
Created November 24, 2016 06:18
benchmark of if and &.
$ ruby -rbenchmark -e 'N=1000_000;a=self;Benchmark.bm{|x| x.report("if") {N.times{a.itself if a}}; x.report("&.") {N.times{a&.itself}}}'
user system total real
if 0.060000 0.010000 0.070000 ( 0.076417)
&. 0.060000 0.000000 0.060000 ( 0.072385)
@nobu
nobu / extmk.rab
Created September 10, 2016 04:18
= extmk
: author
中田伸悦
= 拡張ライブラリ