Skip to content

Instantly share code, notes, and snippets.

View ro31337's full-sized avatar

Roman Pushkin ro31337

View GitHub Profile
@ro31337
ro31337 / rabbitmq.md
Last active April 12, 2023 08:51
Easiest RabbitMQ setup

Install RabbitMQ:

docker run -d --hostname my-rabbit --name blabla-rabbit -p 5672:5672 -p 8080:15672 rabbitmq:3-management

RabbitMQ works based on hostname:

One of the important things to note about RabbitMQ is that it stores data based on what it calls the "Node Name", which defaults to the hostname

@ro31337
ro31337 / instacart.md
Last active December 5, 2018 16:56
InstaCart tech phone screen challenge

Challenge 1

Implement simple key-value storage (KV class), like:

kv = KV.new
kv.set('foo', 'bar')
kv.get('foo') # => returns "bar"
@ro31337
ro31337 / objects.md
Last active October 22, 2018 23:02
Create new object in JavaScript, Object.assign vs destructuring

Define state:

> state = { aa: 11, bb: 22 }
{ aa: 11, bb: 22 }

First way, create new object with Object.assign:

@ro31337
ro31337 / app.rb
Created October 1, 2018 01:26
Игра в грин-карту, поиск счастливой секунды
# Внимание! Перед запуском программы:
# - отключите все соц.сети, мессенджеры, чтобы случайно не нажать.
# - поставьте magic в 3 и _перейдите в ваш браузер_ (!), чтобы программа
# работала в фоне. Посмотрите как ваш терминал уведомит вас. Может
# появиться одинарный звук и всплывающее уведомление. Зависит от
# операционной системы и терминала. Вы должны точно знать как выглядит
# или звучит уведомление, чтобы нажать в правильный момент.
# главная переменная программы, чем больше, тем лучше.
magic = 9
{
"Use Non-ASCII Font" : false,
"Tags" : [
],
"Ansi 12 Color" : {
"Green Component" : 0.3529411764705883,
"Blue Component" : 0.9529411764705882,
"Red Component" : 0.1843137254901961
},
#!/bin/bash
export PATH=/bin:/usr/bin:/usr/local/bin:/sbin:/usr/sbin:/usr/local/sbin
#
# ZeroTier install script
#
# All this script does is determine your OS and/or distribution and then add the correct
# repository or download the correct package and install it. It then starts the service
# and prints your device's ZeroTier address.
#
@ro31337
ro31337 / ruby-it-on-file-change.sh
Last active May 20, 2018 22:26
Run "ruby" over file when file changes (useful for vim + tmux panes, or other tiled window setup. Make sure you +x this script)
#!/bin/bash
#
# Usage: ./ruby-it-on-file-change.sh app.rb
# ^ Will automatically run "ruby app.rb" when file changes
#
echo "Watching for changes in $1, save this file to run \"ruby $1\""
if uname | grep -q "Darwin"; then
mod_time_fmt="-f %m"
else
@ro31337
ro31337 / README.md
Created April 30, 2018 03:49
MariaDB (MySQL) through Docker

MariaDB (MySQL).

Docker is the easiest way to have MariaDB running.

Create volume so your storage will be preserved (argument to -v parameter below):

docker volume create mariadb

Run MariaDB container:

@ro31337
ro31337 / .zshrc
Created April 24, 2018 21:25
Fuzzy + cd, fuzzy + vim
# Change directory with fuzzy find from https://github.com/jhawthorn/fzy
fcd() { cd $(find | fzy) }
# Fuzzy + vim
fvim() { vim $(find | fzy) }
Your views:
=== show.html.erb ===
<% content_for :header do
stylesheet_link_tag 'blabla'
end %>
<% content_for :header do
javascript_include_tag 'blabla'
end %>
<div>