Skip to content

Instantly share code, notes, and snippets.

View rhenium's full-sized avatar
🥐

Kazuki Yamaguchi rhenium

🥐
View GitHub Profile
# usage:
#
# gem install rb-inotify
# ruby tsp_visualize.rb tech30000.{in,out}
require "tk"
require "rb-inotify"
RADIUS = 400
canvas = TkCanvas.new do |c|
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 36db05f..be54063 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -4942,6 +4942,14 @@ static u64 memory_current_read(struct cgroup_subsys_state *css,
return (u64)page_counter_read(&memcg->memory) * PAGE_SIZE;
}
+static u64 memory_max_usage_read(struct cgroup_subsys_state *css,
+ struct cftype *cft)
@rhenium
rhenium / git.diff
Created March 18, 2016 14:22
git branch -m が worktree の HEAD を更新するようになる diff
diff --git a/builtin/branch.c b/builtin/branch.c
index 7b45b6b..07b7afb 100644
--- a/builtin/branch.c
+++ b/builtin/branch.c
@@ -20,6 +20,7 @@
#include "utf8.h"
#include "wt-status.h"
#include "ref-filter.h"
+#include "worktree.h"
@rhenium
rhenium / bug.c
Created December 20, 2015 12:43
Bug #11851: rb_profile_frames() causes segmentation fault - Ruby trunk - Ruby Issue Tracking System https://bugs.ruby-lang.org/issues/11851
#include "ruby.h"
#include "ruby/debug.h"
VALUE
xxx(VALUE self)
{
VALUE buf[10];
int lines[10];
int n;
@rhenium
rhenium / ruby-1.0-build.patch
Created December 19, 2015 10:35
Ruby 1.0 をビルドしようとした
diff --git a/array.c b/array.c
index 39e10a3..cb5d8d3 100644
--- a/array.c
+++ b/array.c
@@ -82,12 +82,10 @@ ary_new()
return ary_new2(ARY_DEFAULT_SIZE);
}
-#include <varargs.h>
+#include <stdarg.h>
@rhenium
rhenium / ruby-openssl-alpn-no-tests-and-docs.patch
Created July 13, 2015 13:38
Ruby の openssl で ALPN をつかえるようにする
diff --git a/ext/openssl/extconf.rb b/ext/openssl/extconf.rb
index b1a527c..a11d40e 100644
--- a/ext/openssl/extconf.rb
+++ b/ext/openssl/extconf.rb
@@ -111,6 +111,7 @@ have_func("TLSv1_2_method")
have_func("TLSv1_2_server_method")
have_func("TLSv1_2_client_method")
have_macro("OPENSSL_NPN_NEGOTIATED", ['openssl/ssl.h']) && $defs.push("-DHAVE_OPENSSL_NPN_NEGOTIATED")
+have_func("SSL_CTX_set_alpn_protos") && $defs.push("-DHAVE_OPENSSL_ALPN")
unless have_func("SSL_set_tlsext_host_name", ['openssl/ssl.h'])
@rhenium
rhenium / gist:e0ea14eb5a95ad279f02
Created July 11, 2015 08:44
titech-pubnet / TokyoTech にログインするやつ
TITECH_ID=00X00000
TITECH_PASS=
curl -d "username=$TITECH_ID" \
--data-urlencode "password=$TITECH_PASS" \
-d "buttonClicked=4" \
https://wlanauth.noc.titech.ac.jp/login.html \
>/dev/null 2>&1
# wlanauth.noc.titech.ac.jp = 131.112.253.250
$port = 10000
require "socket"
server = TCPServer.open($port)
loop do
Thread.start(server.accept) do |cli|
puts "connected: " + cli.__id__.to_s
while line = cli.gets
puts cli.__id__.to_s + ": " + line.chomp
end
0000000: 545a 6966 3200 0000 0000 0000 0000 0000 TZif2...........
0000010: 0000 0000 0000 0003 0000 0003 0000 0000 ................
0000020: 0000 0009 0000 0003 0000 000c c3ce 8570 ...............p
0000030: d73e 1e90 d7ec 1680 d8f9 1690 d9cb f880 .>..............
0000040: db07 1d10 dbab da80 dce6 ff10 dd8b bc80 ................
0000050: 0201 0201 0201 0201 0200 007e 9000 0000 ...........~....
0000060: 008c a001 0400 007e 9000 0843 5554 0055 .......~...CUT.U
0000070: 4454 0055 5354 0000 0000 0000 0054 5a69 DT.UST.......TZi
0000080: 6632 0000 0000 0000 0000 0000 0000 0000 f2..............
0000090: 0000 0000 0500 0000 0500 0000 0000 0000 ................
@rhenium
rhenium / sub_parts_voter_multiline.diff
Last active August 29, 2015 14:02
mikutter の sub_parts_voter(ツイートをふぁぼ・RT したユーザーの一覧)が複数行対応になるパッチ
diff --git a/core/mui/cairo_sub_parts_voter.rb b/core/mui/cairo_sub_parts_voter.rb
index ae53e07..ac2f86a 100644
--- a/core/mui/cairo_sub_parts_voter.rb
+++ b/core/mui/cairo_sub_parts_voter.rb
@@ -12,57 +12,30 @@ class ::Gdk::SubPartsVoter < Gdk::SubParts
def initialize(*args)
super
@icon_width, @icon_height, @margin, @votes, @user_icon = 24, 24, 2, get_default_votes.to_a, Hash.new
- @avatar_rect = []
@icon_ofst = 0