Skip to content

Instantly share code, notes, and snippets.

Avatar

Hiroya Ito hiboma

View GitHub Profile
View fsnotify-race.md
View proc-meminfo-dirty.md

突然のホストダウンで /proc/meminfo の Dirty ページがディスクに同期されず揮発するかどうかの検証

Dirty ページの書き出しを抑えるめちゃくちゃ設定をする

sudo sysctl -w vm.dirty_writeback_centisecs=1000000 # 単位は ms
sudo sysctl -w    vm.dirty_expire_centisecs=1000000 # 単位は ms
sudo sysctl -w    vm.dirty_background_ratio=99
sudo sysctl -w               vm.dirty_ratio=99
```
View thread.c
/**
* kthread_stop - stop a thread created by kthread_create().
* @k: thread created by kthread_create().
*
* Sets kthread_should_stop() for @k to return true, wakes it, and
* waits for it to exit. This can also be called after kthread_create()
* instead of calling wake_up_process(): the thread will exit without
* calling threadfn().
*
* If threadfn() may call do_exit() itself, the caller must ensure
View mogilefs_cpu_usage.pl
#!/usr/bin/perl
use strict;
use warnings;
use IO::Socket;
my %to_be_aggregated = (
'unicorn' => 'unicorn_worker',
'perl-fcgi' => 'perl-fcgi',
'mogilefsd' => 'mogilefsd',
View mogilefs_queryworker.pl
#!/usr/bin/perl
use strict;
use warnings;
::main(@ARGV);
sub print_config {
printf <<"....";
View hoge.diff
--- /tmp/1.txt 2015-08-28 19:10:53.000000000 +0900
+++ /tmp/2.txt 2015-08-28 19:11:05.000000000 +0900
@@ -1,9 +1,5 @@
aa/01.jpg
aa/02.jpg
aa/03.jpg
-aa/bb/01.jpg
-aa/bb/02.jpg
-aa/bb/03.jpg
-aa/cc/01.jpg
View diff
--- /tmp/1.txt 2015-08-28 19:10:53.000000000 +0900
+++ /tmp/2.txt 2015-08-28 19:11:05.000000000 +0900
@@ -1,9 +1,5 @@
aa/01.jpg
aa/02.jpg
aa/03.jpg
-aa/bb/01.jpg
-aa/bb/02.jpg
-aa/bb/03.jpg
-aa/cc/01.jpg
View ox-builder.rb
#!/usr/bin/env ruby
require 'ox'
require 'benchmark'
require 'builder'
NO_SUCH_KEY_CODE = 'NoSuchKey'.freeze
NO_SUCH_KEY_MESSAGE = 'The specified key does not exist.'.freeze
@code = NO_SUCH_KEY_CODE