Skip to content

Instantly share code, notes, and snippets.

Kir Shatrov kirs

Block or report user

Report or block kirs

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View omg.rb
# frozen_string_literal: true
require "bundler/inline"
gemfile(true) do
source "https://rubygems.org"
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
gem "rails", github: "rails/rails"
@kirs
kirs / dance
Last active Jul 6, 2019
Docker snapshot (CRIU) experiments with Rails app and Redmine
View dance
#!/bin/bash
# The script to run actual benchmark
set -e -x
IMAGE=redmine:latest
CHECKPOINT_NAME=checkpoint-redmine
GCS_BUCKET=kirs-criu
@kirs
kirs / notes
Created Jun 24, 2019 — forked from justincormack/notes
criu setup Ubuntu 18.04
View notes
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 http://download.openvz.org/criu/criu-3.10.tar.bz2
tar xjf criu-3.10.tar.bz2
View measure-aws.rb
require 'bundler/inline'
gemfile do
source 'https://rubygems.org'
gem "aws-sdk", "~> 3.0"
end
require 'aws-sdk'
ec2 = Aws::EC2::Resource.new(region: 'us-east-1')
View measure-gcloud.rb
require 'bundler/inline'
gemfile do
source 'https://rubygems.org'
gem 'google-api-client', '~> 0.11'
end
require 'google/apis/compute_v1'
Google::Apis.logger = Logger.new(STDERR)
Google::Apis.logger.level = Logger::INFO
View gist:b2cc6aa66874d68e4137470c98e12537
iter = Enumerator.new do |yielder|
yielder.yield "start"
3.times { |n| yielder.yield(n) }
yielder.yield "end"
end
# iter.each do |n|
# puts n
# end
View gist:79f56d9075dc83a06f5f609cc6b40de2
$ curl -v https://js.pusher.com/4.0/pusher.min.js
* Trying 23.111.9.14...
* TCP_NODELAY set
* Connected to js.pusher.com (23.111.9.14) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* Cipher selection: ALL:!EXPORT:!EXPORT40:!EXPORT56:!aNULL:!LOW:!RC4:@STRENGTH
* successfully set certificate verify locations:
* CAfile: /etc/ssl/cert.pem
CApath: none
View sigint.rb
require 'active_support/callbacks'
class Job
include ActiveSupport::Callbacks
define_callbacks :perform
set_callback :perform, :after, :save_omg
def perform
@kirs
kirs / gdb_ruby_backtrace.py
Created Sep 3, 2017 — forked from csfrancis/gdb_ruby_backtrace.py
Dump an MRI call stack from gdb
View gdb_ruby_backtrace.py
# 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()
else:
return s['as']['ary'].string()
View includes.rb
require 'bundler/setup'
require 'active_support/all'
module Feature
extend ActiveSupport::Concern
included do |base|
puts "#{base} included Feature"
end
end
You can’t perform that action at this time.