Skip to content

Instantly share code, notes, and snippets.

kirs / queuing.rb
Created April 20, 2020 15:00 — forked from sirupsen/queuing.rb
Queuing theory exercise
class Node
attr_accessor :edges, :jobs, :id
def initialize(id, arrivals_per_tick)
@id = id
@jobs = 0.0
@tick = 0
@edges = []
@arrivals_per_tick = arrivals_per_tick
kirs / notes
Created June 24, 2019 15:16 — forked from justincormack/notes
criu setup Ubuntu 18.04
apt update
apt upgrade
apt install build-essential
apt install pkg-config
apt install libnet-dev python-yaml libaio-dev
apt install libprotobuf-dev libprotobuf-c0-dev protobuf-c-compiler protobuf-compiler python-protobuf libnl-3-dev libcap-dev python-future
# criu install
curl -O -sSL
tar xjf criu-3.10.tar.bz2
kirs /
Created September 3, 2017 16:22 — forked from csfrancis/
Dump an MRI call stack from gdb
# Updated for Ruby 2.3
string_t = None
def get_rstring(addr):
s = addr.cast(string_t.pointer())
if s['basic']['flags'] & (1 << 13):
return s['as']['heap']['ptr'].string()
return s['as']['ary'].string()
kirs / gist:2a0025466944def92b3be3e0d04266cd
Created April 9, 2017 15:20 — forked from tonyc/gist:1384523
Using strace and lsof

Using strace and lsof to debug blocked processes

You can use strace on a specific pid to figure out what a specific process is doing, e.g.:

strace -fp <pid>

You might see something like:

select(9, [3 5 8], [], [], {0, 999999}) = 0 (Timeout)

kirs /
Last active November 22, 2016 21:26

Legacy Database # => "Renan"

After put encrypted_coder.rb and crypt.rb # => OpenSSL::Cipher::CipherError: bad decrypt
kirs /
Created October 3, 2016 21:54 — forked from mislav/
Publish a git branch and open a tmux split that reports the outcome of CI
# Pushes the current branch to origin and opens a tiny tmux split to track
# the CI status. Upon completion, speaks the status aloud using `say`.
set -e
if [ "$1" != "--wait" ]; then
git push -u origin HEAD
tmux split-window -dv -l 2 "'$0' --wait"
ref="$(git rev-parse -q HEAD)"
require "rubocop"
module RuboCop
module Cop
module Lint
# This cop checks bad use of the Minitest `assert` method
# `assert` method's second argument is the error message when the
# first argument evals to false.
kirs /
Created July 5, 2016 19:37 — forked from strizhechenko/
Программа для underhood.ko

Опции bash для разработки

Разрабатывайте скрипты с опциями set -eu

  • set -e - падать на ошибках
  • set -u - считать ошибкой обращение к неопределенной переменной


  • максимально быстрое выявление скрытых ошибок в коде.
  • не надо самому писать многие проверки значений.
  • Это сделает shell-код похожим на нормальный язык программирования, а не на набор последовательно выполняющихся команд, которым на всё пофиг.

Step 0:

Get Homebrew installed on your mac if you don't already have it

Step 1:

Install highlight. "brew install highlight". (This brings down Lua and Boost as well)

Step 2:

kirs / upload.rb
Last active December 21, 2015 08:59 — forked from Olefine/upload.rb
class MessageImageWorker
@queue = :message_image_queue
def self.perform(message_id, image_path)
MessageImage.create!(message_id: message_id, image: image_path)