Skip to content

Instantly share code, notes, and snippets.

View yura's full-sized avatar

Yuriy Kotlyarov yura

View GitHub Profile
@yura
yura / sansara.py
Last active September 8, 2023 06:50
Samadhi = False
while not Samadhi:
you = Being.born
you.do_yoga
Smadhi = you.do_yoga
you.die

Keybase proof

I hereby claim:

To claim this, I am signing this object:

@yura
yura / hello11.cpp
Created August 12, 2016 01:40
Initializing constexpr variable by a lambda
#include <iostream>
#include <string>
constexpr auto fx = [] (std::string msg) {
return msg + "!\n"; };
int main(int argc, char* argv[]) {
if (argc == 2)
std::cout << "hello " << fx(argv[1]);
else
@yura
yura / chat.rb
Created December 17, 2011 13:34 — forked from rkh/chat.rb
Simple Chat Application using the Sinatra Streaming API
# coding: utf-8
require 'sinatra'
set server: 'thin', connections: []
get '/' do
halt erb(:login) unless params[:user]
erb :chat, locals: { user: params[:user].gsub(/\W/, '') }
end
get '/stream', provides: 'text/event-stream' do
# Тест из видео Ильи Григорика http://www.igvita.com/2010/06/07/rails-performance-needs-an-overhaul/
require 'rubygems'
require 'active_record'
ActiveRecord::Base.establish_connection(
:adapter => :mysql,
:database => 'mysql',
:username => 'root',
:password => '',
@yura
yura / pdf2jpg.sh
Created November 10, 2010 15:18
script to PDF to JPG using pdftk and imagemagick
#!/bin/bash
# Script to convert PDF file to JPG images
#
# Dependencies:
# * pdftk
# * imagemagick
PDF=$1
$ gem i rmagick
Building native extensions. This could take a while...
ERROR: Error installing rmagick:
ERROR: Failed to build gem native extension.
/usr/bin/ruby.exe extconf.rb
checking for Ruby version >= 1.8.5... yes
checking for gcc... yes
checking for Magick-config... yes
CmdUtils.CreateCommand({
names: ["github"],
icon: "http://github.com/favicon.ico",
description: "GitHub search",
author: {name: "Yury Kotlyarov", email: "yura@brainhouse.ru"},
license: "Ruby",
homepage: "http://www.brainhouse.ru/",
arguments: [{role: 'object', nountype: noun_arb_text, label: 'search query'}],
_getSearchUrl: function(query) {
@yura
yura / have_form.rb
Created February 12, 2009 09:19
rspec complex custom matchers
module CustomUiMatchers
class HaveForm
def initialize(action, scope, &block)
@action, @scope, @block = action, scope, block
end
def matches?(response, &block)
@block = block if block
response.should @scope.have_tag('form[action=?]', @action) do |form|