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 gist:bc6215a358578d6f4e395a2dcab4ccc5
int deserialize_String_vector(struct iarchive *in, const char *tag, struct String_vector *v)
{
int rc = 0;
int32_t i;
rc = in->start_vector(in, tag, &v->count);
v->data = calloc(v->count, sizeof(*v->data));
for(i=0;i<v->count;i++) {
rc = rc ? rc : in->deserialize_String(in, "value", &v->data[i]);
}
rc = in->end_vector(in, tag);
View shopify_deadlines.rb
class Deadline
def self.current=(value)
ActiveRecord::Base.deadline = value
end
def initialize(duration_seconds)
@deadline = now + duration_seconds.to_i
end
def extend_deadline(duration_seconds)
View omg.rb
# frozen_string_literal: true
require 'benchmark/ips'
require 'securerandom'
str = "#{SecureRandom.alphanumeric(1000)} SUBSTR"
Benchmark.ips do |x|
x.config(:time => 5, :warmup => 2)
x.report("=~") do |t|
100.times do
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
You can’t perform that action at this time.