Skip to content

Instantly share code, notes, and snippets.

View dmytrotkk's full-sized avatar
🐵

Dmytro dmytrotkk

🐵
View GitHub Profile
@dmytrotkk
dmytrotkk / .bash_profile
Created February 17, 2021 10:25
Random emoji for bash session
random_emoji() {
emojis=(📚 🚀 🐍 🌎 🎉 🎸 🌈 💻 🌿 🍀 🌝 🍊)
selectedexpression=${emojis[$RANDOM % ${#emojis[@]} ]}
echo $selectedexpression
}
export PS1="$(random_emoji) $ "
@dmytrotkk
dmytrotkk / convoy_service_setup.sh
Created October 19, 2019 08:16
Limit Docker volume size tutorial snippet
cp ./convoy_example.service /etc/systemd/system/convoy.service
systemctl enable convoy
systemctl start convoy
@dmytrotkk
dmytrotkk / convoy_full_installation.sh
Last active January 9, 2020 21:16
Limit Docker volume size tutorial
# install convoy
wget https://github.com/rancher/convoy/releases/download/v0.5.2/convoy.tar.gz
tar xvzf convoy.tar.gz
sudo cp convoy/convoy convoy/convoy-pdata_tools /usr/local/bin/
sudo mkdir -p /etc/docker/plugins/
sudo bash -c 'echo "unix:///var/run/convoy/convoy.sock" > /etc/docker/plugins/convoy.spec'
# download and execute preparation script
@dmytrotkk
dmytrotkk / docker_volume_create.sh
Created October 18, 2019 10:37
Limit Docker volume size tutorial snippet
docker volume create --driver convoy --opt size=100m test
@dmytrotkk
dmytrotkk / convoy.service
Created October 18, 2019 10:34
Limit Docker volume size tutorial snippet
[Unit]
Description=Convoy volume management service
After=network.target
StartLimitIntervalSec=0
[Service]
Type=simple
Restart=always
RestartSec=5
ExecStart=convoy daemon --drivers devicemapper --driver-opts dm.datadev=$DISK_MOUNTPOINT\1 --driver-opts dm.metadatadev=$DISK_MOUNTPOINT\2
@dmytrotkk
dmytrotkk / run_convoy.sh
Created October 18, 2019 10:30
Limit Docker volume size tutorial snippet
convoy daemon --drivers devicemapper --driver-opts dm.datadev=$DISK_MOUNTPOINT\1 --driver-opts dm.metadatadev=$DISK_MOUNTPOINT\2 &
@dmytrotkk
dmytrotkk / install_dm_helper.sh
Created October 18, 2019 10:02
Limit Docker volume size tutorial snippet
wget https://raw.githubusercontent.com/rancher/convoy/master/tools/dm_dev_partition.sh
bash dm_dev_partition.sh --write-to-disk $DISK_MOUNTPOINT
@dmytrotkk
dmytrotkk / convoy_install.sh
Created October 8, 2019 09:59
Convoy install
wget https://github.com/rancher/convoy/releases/download/v0.5.2/convoy.tar.gz
tar xvzf convoy.tar.gz
sudo cp convoy/convoy convoy/convoy-pdata_tools /usr/local/bin/
sudo mkdir -p /etc/docker/plugins/
sudo bash -c 'echo "unix:///var/run/convoy/convoy.sock" > /etc/docker/plugins/convoy.spec'
@dmytrotkk
dmytrotkk / rails_permissions.md
Created November 17, 2017 13:44
Checking permissions in Rails

Checking permissions in Rails

What we will use:

Let's just start with an example

Let's suppose that you have a method do_something, which could be preformed only by user who's matching permissions view_payment_info, if options[:some_key] isn't

@dmytrotkk
dmytrotkk / rails_lib_services.md
Created November 14, 2017 13:07
Rails app: Organizing `lib` directory with static services

Organizing lib directory with static services

base_service.rb
    module Core end

    module Core::BaseService
 extend self