Skip to content

Instantly share code, notes, and snippets.

View Wolwer1nE's full-sized avatar
⚒️

Pavel Wolwer1nE

⚒️
View GitHub Profile
@Wolwer1nE
Wolwer1nE / ruby_bot_test_proxy.rb
Last active November 29, 2018 07:27
Setup telegram-bot-ruby with proxy
# https://github.com/atipugin/telegram-bot-ruby
# Uninstall all other telegram bot gems before installing telegram-bot-ruby
# All of them use same namespace
require 'telegram/bot'
token = '' #your token here
Telegram::Bot::Client.run(token) do |bot|
# we don't have API to setup Faraday connection, so we will override it
bot.api.send(:conn).proxy = 'https://90.176.152.12:41586' #get some free proxy here https://www.sslproxies.org/
#test connection
class VkController < ApplicationController
skip_before_action :verify_authenticity_token, raise: false
def index
a = params['name']
return render json: {'key'=>a.reverse!}
end
def wow
a = params['name']
require 'aws-sdk-s3'
require 'net/http'
creds = Aws::Credentials.new('', '')
s3 = Aws::S3::Resource.new(
credentials: creds,
endpoint: 'https://storage.yandexcloud.net',
region: 'us-east-1'
)
createAnimations: function()
{
//тут я генерил анимации мальчику и девочке
this.createAnimation("side", [1, 7, 1, 13] );
this.createAnimation("up", [2, 8, 2, 14] );
this.createAnimation("down", [ 0, 6, 0, 12 ] );
this.createAnimation("enemy_down", [ 21, 27, 21, 33 ]);
this.createAnimation("searcher_side", [4, 10, 4, 16] );
# Function prints results of block execution
# and prints message if no block was given
def function_that_can_accept_block(x, &block)
return "Wow, no block was given!" unless block_given?
block.call(x)
end
def some_other_function(x)
"I am a function and I print my input: #{x}"
def integrating_Monte_Carlo_base(a, b, n = 100, &block)
sum = 0
res = 0
# чтобы в цикле не считать этот диапазон
range = a..b.to_f
for i in 0..n
# ваша версия rand не работала, на вход надо либо одно число, либо Range
x = rand(range)
# debug print
p x
def breadth_first_search?(start, goal)
visited = Hash.new(false)
queue = Queue.new << start
visited[start] = true
until queue.empty?
node = queue.pop
return true if node == goal
@vertices[node].each { |child| bfs_add_node(queue, visited, child) }
end
false
a = [[0,1,1], [1,2,2], [2,0,1]]
def select_row(a, i, n)
row = Array.new(n, 0)
a.select{ |x| x[0] == i }.each do |x|
row[x[1]] = x[2]
end
row
end
class HomeController < ApplicationController
def index
end
end
a-scene
a-box color="#4CC3D9" position=("-1 0.5 -3") rotation=("0 45 0")
a-sphere color="#EF2D5E" position=("0 1.25 -5") radius="1.25"
a-cylinder color="#FFC65D" height="1.5" position=("1 0.75 -3") radius="0.5"
a-plane color="#7BC8A4" height="4" position=("0 0 -4") rotation=("-90 0 0") width="4"
a-sky color="#ECECEC"