Skip to content

Instantly share code, notes, and snippets.

@maxivak
maxivak / readme.md
Last active April 11, 2023 15:08
Restore repo from Gitlab bundle file

Gitlab exports repositories to tar archive which contains .bundle files.

We have repo.bundle file and we want to restore files from it.

  • create bare repo from bundle file
git clone --mirror myrepo.bundle my.git
@maxivak
maxivak / __upload_file.md
Last active February 10, 2024 08:32
PHP upload file with curl (multipart/form-data)

We want to upload file to a server with POST HTTP request. We will use curl functions.


// data fields for POST request
$fields = array("f1"=>"value1", "another_field2"=>"anothervalue");

// files to upload
$filenames = array("/tmp/1.jpg", "/tmp/2.png");
@maxivak
maxivak / ubuntu16_rename_eth.md
Last active October 17, 2017 08:26
Rename interface to eth0 on Ubuntu 16.04

Fix interface to 'eth0'

for ubuntu 16.04:

sudo sed -i "s/GRUB_CMDLINE_LINUX_DEFAULT=\"\(.*\)\"/GRUB_CMDLINE_LINUX_DEFAULT=\"\1 net.ifnames=0\"/" /etc/default/grub 
sudo update-grub2
  • reboot
@maxivak
maxivak / provision_chef_knife_solo.md
Last active April 15, 2017 19:15
Provisioning a server accessible by SSH with Chef solo and knife solo

Provision a server with Chef

we have a server which we can access by SSH and we want to provision it using Chef recipes.

knife-solo

knife-solo makes working with chef-solo as powerful as chef-server.

@maxivak
maxivak / temp.md
Last active March 16, 2017 10:15
temp

1

@maxivak
maxivak / readme.md
Last active March 30, 2019 01:09
Storage for Docker containers in Swarm mode

Manage data in containers in swarm mode

Overview

Approaches to data storages:

  • Default : No Data Persistence
  • Data Volumes : Container Persistence
  • Explicit Shared Storage (Data Volumes) : Container Persistence
  • Shared Multi-Host Storage : Host Persistence
@maxivak
maxivak / docker_network.md
Last active June 21, 2018 16:32
Docker network

Contents

  • Bridge for isolated network
  • Public network with macvlan
  • Containers in multiple networks on one host
  • Connect from host machine to Docker container

Bridge network

Features:

@maxivak
maxivak / ssh_commands.md
Last active May 4, 2017 09:34
Running commands on remote server with SSH using SSHKit

Running commands on remote server with SSH using SSHKit

We have a server which we can connect by SSH and we want to run commands there.

We will use SSHKit gem for it.

Gems:

gem 'net-ssh'
gem 'sshkit'
@maxivak
maxivak / readme.md
Last active October 19, 2017 08:37
Backups

Backups

Backup strategy

Storage

Store backups

  • Local disk
  • Remote storage - copy by scp
  • Remote storage - sync using Rsync