Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am krasnoukhov on github.
  • I am krasnoukhov (https://keybase.io/krasnoukhov) on keybase.
  • I have a public key ASBgn51BbUX1N1f3Sa7m7ZKIEHfT_FXhmmQIOO0m2CeWkwo

To claim this, I am signing this object:

import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
{"clients":{},"devices":{"00:1A:22:12:D8:38":{"availableFirmwareVersion":null,"firmwareVersion":null,"groupId":"17f51411-4be0-4155-98f6-9a03bbde5681","groups":[],"id":"00:1A:22:12:D8:38","label":"Device","lastStatusUpdate":0,"lowBat":false,"unreach":false,"updateState":null,"operationLockActive":false,"temperatureOffset":0,"valvePosition":null,"type":"HEATING_THERMOSTAT"}},"groups":{"17f51411-4be0-4155-98f6-9a03bbde5681":{"channels":null,"devices":["00:1A:22:12:D8:38"],"homeId":null,"id":"17f51411-4be0-4155-98f6-9a03bbde5681","label":"Room","lastStatusUpdate":0,"lowBat":null,"metaGroupId":null,"unreach":null,"activeProfile":null,"actualTemperature":null,"boostDuration":0,"boostMode":false,"controlMode":"AUTOMATIC","maxTemperature":29.5,"minTemperature":5,"nextSwitchPoint":null,"profiles":null,"setPointTemperature":17,"windowOpen":null,"windowOpenTemperature":12,"type":"HEATING"}},"home":{"absenceEndTime":"","absenceType":"NOT_ABSENT","availableAPVersion":null,"clients":[],"connected":false,"currentAPVersion":
@krasnoukhov
krasnoukhov / output
Created April 17, 2015 17:05
ember-cli output
krasnoukhov in ~/Downloads/my-app 💃 PATH=$PATH:./node_modules/ember-cli/bin/ ember server
Future versions of Ember CLI will not support v0.10.36. Please update to Node 0.12 or io.js.
version: 0.2.3
Could not find watchman, falling back to NodeWatcher for file system events.
Visit http://www.ember-cli.com/#watchman for more info.
Livereload server on port 35729
Serving on http://localhost:4200/
Build successful - 5327ms.
@krasnoukhov
krasnoukhov / omg.rb
Last active August 29, 2015 14:17
INSTANCE EVALER!
omg = Class.new do
attr_accessor :test1
attr_accessor :test2
def inspect
puts "test1", test1.inspect
puts "test2", test2.inspect
puts "="*40
end
end
@krasnoukhov
krasnoukhov / 2013-01-07-profiling-memory-leaky-sidekiq-applications-with-ruby-2.1.md
Last active October 4, 2023 21:53
Profiling memory leaky Sidekiq applications with Ruby 2.1

My largest Sidekiq application had a memory leak and I was able to find and fix it in just few hours spent on analyzing Ruby's heap. In this post I'll show my profiling setup.

As you might know Ruby 2.1 introduced a few great changes to ObjectSpace, so now it's much easier to find a line of code that is allocating too many objects. Here is great post explaining how it's working.

I was too lazy to set up some seeding and run it locally, so I checked that test suite passes when profiling is enabled and pushed debugging to production. Production environment also suited me better since my jobs data can't be fully random generated.

So, in order to profile your worker, add this to your Sidekiq configuration:

if ENV["PROFILE"]
@krasnoukhov
krasnoukhov / Gemfile
Created November 5, 2014 10:08
SAXMachine nokogiri proof
source "https://rubygems.org"
gem "sax-machine", github: "pauldix/sax-machine"
gem "nokogiri"
@krasnoukhov
krasnoukhov / coffee.md
Created October 2, 2014 11:20
Brewing filtered coffee (essay)

Brewing filtered coffee

It's no secret there are a lot of ways of brewing a cup of delicious coffee. Basically, coffee can be prepared through the boiling, steeping, filtration or by using the pressure. I find filter-based brewing the most convenient in terms of operational simplicity and resulting flavour, so let's see how exactly it can be prepared.

The common idea between different filter brewing methods is that water is poured into the pot through the grained beans, and filter helps to restrain beans from getting into it. However, there are things that may vary, such as water temperature, beans grind level and the design of coffee pot itself.

Baruco 2014 talks

mruby: AltRuby

by YUKIHIRO MATSUMOTO (Twitter)

Standard Library, Uncommon Uses

by PIOTR SZOTKOWSKI (Twitter)

Slides

@krasnoukhov
krasnoukhov / intra
Created July 30, 2014 13:04
memcached
$ time telnet memcached.theoldreader.intra 11211 | echo quit
quit
real 0m5.026s
user 0m0.015s
sys 0m0.007s