Skip to content

Instantly share code, notes, and snippets.

@andreyka26-git
andreyka26-git / gist:89138ea2ba44231f5080e2b67f0e2dac
Created August 25, 2021 15:59
[Windows 10] Continuous ping with time on powershell
ping.exe -t google.com|Foreach{"{0} - {1}" -f (Get-Date),$_}
@andreyka26-git
andreyka26-git / gitlab-runner-dind-setup.txt
Last active February 8, 2023 12:43
GitLab runner in docker (using dind) with sample gitlab.ci set up
** run these commands inside your machine
docker run -v /srv/gitlab-runner/config:/etc/gitlab-runner --name runner -v /var/run/docker.sock:/var/run/docker.sock -d gitlab/gitlab-runner
docker exec -it runner bash
gitlab-runner register -n \
--url "https://gitlab.com/" \
--registration-token "qSf6YzdsXjMug69WxVTt" \
--executor "docker" \
@nazarii-piontko
nazarii-piontko / OrderedDictionary.cs
Created January 10, 2020 17:54
OrderedDictionary is data structure that is similar to Dictionary, but allow to track sequence of adding key/value pairs (e.g. Queue and Dictionary in one class)
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
namespace DataStructures
{
/// <summary>
/// OrderedDictionary is data structure that is similar to Dictionary, but allow to track sequence of adding key/value pairs (e.g. Queue and Dictionary in one class)
/// </summary>
@nazarii-piontko
nazarii-piontko / Heap.cs
Created January 10, 2020 17:53
C# Heap implementation
using System;
using System.Collections;
using System.Collections.Generic;
namespace DataStructures
{
public class Heap<T> : ICollection<T>
{
private const int DefaultCapacity = 16;
@nazarii-piontko
nazarii-piontko / rsync-fast.sh
Last active April 25, 2021 12:20
Fast rsync transfer options
#!/bin/bash
rsync -aHAXxv --numeric-ids -e "ssh -oStrictHostKeyChecking=no -T -c aes128-gcm@openssh.com -o Compression=no -x" $1 $2
# https://explainshell.com/explain?cmd=rsync+-aHAXxv+--numeric-ids+-e+%22ssh+-oStrictHostKeyChecking%3Dno+-T+-c+aes128-gcm%40openssh.com+-o+Compression%3Dno+-x%22
# https://explainshell.com/explain?cmd=ssh+-oStrictHostKeyChecking%3Dno+-T+-c+aes128-gcm%40openssh.com+-o+Compression%3Dno+-x
@nazarii-piontko
nazarii-piontko / certbot-wildcard.sh
Last active April 25, 2021 12:21
Letsencrypt/Cerbot generate wildcard certificate
#!/bin/bash
certbot certonly \
--manual \
-d *.$1 \
-d $1 \
--agree-tos \
--no-bootstrap \
--manual-public-ip-logging-ok \
--preferred-challenges dns-01 \
@nazarii-piontko
nazarii-piontko / benchmark-disk-io.sh
Last active April 25, 2021 12:22
Benchmark disk I/O on Linux (Ubuntu)
#!/bin/bash
# Install
apt-get update -y
apt-get install -y fio
# Random read/write
fio --randrepeat=1 --ioengine=libaio --direct=1 --gtod_reduce=1 --name=test --filename=test --bs=4k --iodepth=64 --size=4G --readwrite=randrw --rwmixread=75
# Randon read
@nazarii-piontko
nazarii-piontko / useradd.txt
Created June 4, 2018 21:41
Create system user account on Ubuntu
sudo useradd -r -s /bin/false <username>
@nazarii-piontko
nazarii-piontko / install-sphinxsearch3
Last active April 25, 2021 12:22
Bash script that install Sphinxsearch 3.0.3 on Ubuntu system
#!/bin/bash
# Sphinxsearch 3.0.3 install script for Ubuntu.
# It downloads sphinxsearch 3.0.3 and installs as daemon with dummy configuration.
# http://sphinxsearch.com
set -e
# Package manager update and recommended packages installation
apt-get update -y