Skip to content

Instantly share code, notes, and snippets.

@pik
pik / inotify_count.txt
Created October 17, 2016 15:20
Inotify use count
> /bin/bash -c "grep ^inotify /proc/[0-9]*/fdinfo/*" |cut -d/ -f3 |uniq -c | ruby -e "while not STDIN.eof?; (count, pid) = gets.chomp.split(' '); name = `cat /proc/#{pid}/cmdline`; puts \"#{name} : #{count}\"; end"
grep: /proc/29194/fdinfo/3: No such file or directory
grep: /proc/29195/fdinfo/3: No such file or directory
grep: /proc/29195/fdinfo/4: No such file or directory
grep: /proc/29195/fdinfo/5: No such file or directory
grep: /proc/29196/fdinfo/3: No such file or directory
grep: /proc/29196/fdinfo/4: No such file or directory
grep: /proc/29196/fdinfo/5: No such file or directory
grep: /proc/29196/fdinfo/6: No such file or directory
@pik
pik / journalctl.strace
Created October 17, 2016 14:30
journalctl --follow strace
execve("/usr/bin/journalctl", ["journalctl", "--follow"], [/* 33 vars */]) = 0
brk(NULL) = 0x55f1275a5000
access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
open("/usr/lib/systemd/tls/x86_64/libsystemd-shared-231.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/usr/lib/systemd/tls/x86_64", 0x7ffc23bcd7f0) = -1 ENOENT (No such file or directory)
open("/usr/lib/systemd/tls/libsystemd-shared-231.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/usr/lib/systemd/tls", 0x7ffc23bcd7f0) = -1 ENOENT (No such file or directory)
open("/usr/lib/systemd/x86_64/libsystemd-shared-231.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("/usr/lib/systemd/x86_64", 0x7ffc23bcd7f0) = -1 ENOENT (No such file or directory)
open("/usr/lib/systemd/libsystemd-shared-231.so", O_RDONLY|O_CLOEXEC) = 3
@pik
pik / tilda-core.dump
Created August 22, 2016 20:14
Tilda Core dump
Aug 22 17:11:07 182af44a kernel: traps: tilda[1621] general protection ip:7ff2d185d98a sp:7ffed135bbe0 error:0 in libgobject-2.0.so.0.4800.1[7ff2d1829000+51000]
Aug 22 17:11:07 182af44a systemd[1]: Started Process Core Dump (PID 12051/UID 0).
Aug 22 17:11:07 182af44a systemd-coredump[12052]: Process 1621 (tilda) of user 1000 dumped core.
Stack trace of thread 1621:
#0 0x00007ff2d185d98a g_type_check_instance_cast (libgobject-2.0.so.0)
#1 0x000000000040c274 n/a (tilda)
#2 0x00007ff2d1838fa5 g_closure_invoke (libgobject-2.0.so.0)
#3 0x00007ff2d184afb2 n/a (libgobject-2.0.so.0)
#4 0x00007ff2d1853c1c g_signal_emit_valist (libgobject-2.0.so.0)
@pik
pik / dump-stats.post
Created May 1, 2016 13:00
object-space-dump-stats
# MEMSIZE TOTALS BY GENERATION
(103, '40.0 BB'),
(108, '449.0 BB'),
(83, '504.0 BB'),
(100, '544.0 BB'),
(98, '938.0 BB'),
(97, '1.5 KiB'),
(64, '1.7 KiB'),
(75, '1.8 KiB'),
(84, '2.2 KiB'),
@pik
pik / rails_server_segfault1.txt
Created April 30, 2016 09:20
Rails Server Segfaults with ObjectSpace
/home/user/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/sprockets-3.4.0/lib/sprockets/resolve.rb:126: [BUG] Segmentation fault at 0x000000016e6194
ruby 2.2.4p230 (2015-12-16 revision 53155) [x86_64-linux]
-- Control frame information -----------------------------------------------
c:0222 p:0038 s:1333 E:000590 BLOCK /home/user/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/sprockets-3.4.0/lib/sprockets/resolve.rb:126 [FINISH]
c:0221 p:---- s:1323 e:001322 CFUNC :each
c:0220 p:0055 s:1320 E:0002f8 METHOD /home/user/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/sprockets-3.4.0/lib/sprockets/resolve.rb:123
c:0219 p:0051 s:1312 e:001311 METHOD /home/user/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/sprockets-3.4.0/lib/sprockets/resolve.rb:107
c:0218 p:0147 s:1297 e:001296 METHOD /home/user/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/sprockets-3.4.0/lib/sprockets/resolve.rb:35
c:0217 p:0078 s:1284 e:001283 METHOD /home/user/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/sprockets-3.4.0/lib/sprockets/leg
@pik
pik / jhbuildrc
Created April 20, 2016 14:46
JHBuild config
# -*- mode: python -*-
# -*- coding: utf-8 -*-
# edit this file to match your settings and copy it to ~/.config/jhbuildrc
# if you have a GNOME git account, uncomment this line
# repos['git.gnome.org'] = 'ssh://user@git.gnome.org/git/'
# what module set should be used. The default can be found in
# jhbuild/defaults.jhbuildrc, but can be any file in the modulesets directory
[hekad]
maxprocs = 2
[HerokuSyslogInput]
type = 'TcpInput'
address = '0.0.0.0:1514'
#decoder = 'RsyslogDecoder'
decoder = ''
use_tls = true
[HerokuSyslogInput.tls]
@pik
pik / ssl_server.py
Created January 14, 2016 02:13
ssl syslog receive test
import socket
import select
import os
import ssl
import time
import logging
import threading
ensure_list = lambda l: l if isinstance(l, list) else [l]
Requiring File -- active_support/descendants_tracker
Requiring File -- active_model/serializer
Requiring File -- active_support/core_ext/class/attribute
Requiring File -- active_support/core_ext/module/anonymous
Requiring File -- active_support/dependencies
Requiring File -- active_support/descendants_tracker
Requiring File -- active_model/serializer/associations
Requiring File -- set
Requiring File -- action_controller
Requiring File -- action_controller/serialization
@pik
pik / lockable.rb
Created January 3, 2016 04:06
Pessimistic Locking Concern for AR
module Lockable
extend ActiveSupport::Concern
LOCKABLE = { on: :self }
def transaction_has_lock_for(target)
(transaction_get_locks || []).include?(target)
end
def transaction_add_lock(lock)