Skip to content

Instantly share code, notes, and snippets.

View kritik's full-sized avatar

Vladimir Krylov kritik

  • PerfectLine
  • Tallinn, Estonia
View GitHub Profile
@kritik
kritik / printerbot.py
Last active January 27, 2022 19:11 — forked from DeNcHiK3713/printerbot.py
Telegram bot for printer (Linux)
import os
import pathlib
import logging
from telegram.ext import Updater
from telegram.ext import Filters
from telegram.ext import CommandHandler
from telegram.ext import MessageHandler
# This is the Telegram Bot that prints all input documents. It can print pdf and txt files.
# Before sending files for printing user must enter the password by command "/auth <password>".
@kritik
kritik / JS_closure.js
Last active February 22, 2020 13:14
JS snippets
function createCalcFunction(n){
return function(){
console.log(1000*n)
}
}
const calc = createCalcFunction(42) // no calc, just initialization
calc() // prints 42000
function bind(context, fn){
@kritik
kritik / NGINX.configure_install
Last active February 21, 2020 08:57
NGINX comments.conf
./configure --help|grep without
./configure --with-http_v2_module --with-http_ssl_module --without-http_autoindex_module
# todo: add brotli installation guides for Debian
@kritik
kritik / numerical_validation.rb
Created November 3, 2015 12:12
Fast fix her with numerical validation
module ActiveModel
module Validations
class NumericalityValidator < EachValidator # :nodoc:
private
def record_attribute_changed_in_place?(record, attr_name)
false
end
end
end
Estonia .ee Top Level Domain WHOIS server
Domain:
name: sexikas4.ee
status: forceDelete
status: serverRenewProhibited
status: serverTransferProhibited
registered: 2015-10-27 14:24:30 +0200
changed: 2015-10-27 14:25:17 +0200
expire: 2016-10-27
@kritik
kritik / install.log
Created October 26, 2014 11:00
failing ruby install
pi@raspberrypi ~ $ sudo apt-get install ruby2.1
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
fonts-freefont-ttf libclass-isa-perl libswitch-perl ttf-dejavu-core
Use 'apt-get autoremove' to remove them.
The following extra packages will be installed:
javascript-common libjs-jquery libruby2.1 libyaml-0-2 rubygems-integration
Suggested packages:
{
"cluster_name" : "elasticsearch_vladimir",
"status" : "red",
"timed_out" : false,
"number_of_nodes" : 1,
"number_of_data_nodes" : 1,
"active_primary_shards" : 16,
"active_shards" : 16,
"relocating_shards" : 0,
"initializing_shards" : 4,
RubyProf.start
User.new({token: "$2a$10$Iii/rh4SAu4SN4bSz2d6kO0XRgny71iMFxQtArvwZuUhNcjigHW7S"}, true).find_photo(37)
result = RubyProf.stop
printer = RubyProf::FlatPrinter.new(result)
printer.print(STDOUT)
Thread ID: 70098585257680
Fiber ID: 70098618506940
Total: 0.139586
Sort by: self_time
@kritik
kritik / gist:5204504
Created March 20, 2013 13:07
warRoom
Vladimirs-iMac:thewarroom_fantasy_feed vladimir$ bundle exec sidekiq start -C config/sidekiq.yml
WARNING: Nokogiri was built against LibXML version 2.8.0, but has dynamically loaded 2.7.8
Skipping index creation, cannot connect to Elasticsearch
(The original exception was: #<Errno::ECONNREFUSED: Connection refused - connect(2)>)
Instance method "true?" is already defined in Object, use generic helper instead or set StateMachine::Machine.ignore_method_conflicts = true.
/Users/vladimir/.rvm/gems/ruby-1.9.3-p374/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:251:in `block in require': iconv will be deprecated in the future, use String#encode instead.
Skipping index creation, cannot connect to Elasticsearch
(The original exception was: #<Errno::ECONNREFUSED: Connection refused - connect(2)>)
Instance method "true?" is already defined in Object, use generic helper instead or set StateMachine::Machine.ignore_method_conflicts = true.
Skipping index creation, cannot connect to Elasticsearch