Skip to content

Instantly share code, notes, and snippets.

View nechkin's full-sized avatar
🎯
Focusing

Sergey nechkin

🎯
Focusing
View GitHub Profile
@nechkin
nechkin / howto.md
Created October 21, 2019 05:19 — forked from petrkohut/howto.md
How to have redis-cli and psql installed on machine using Docker

How to install redis-cli and psql client on your machine with Docker

Preparing docker images

We will use minimalistic Linux distribution called Alpine (5MB)

Dockerfile of redis-cli

FROM alpine:latest
RUN apk --update add redis
@nechkin
nechkin / git_submodules.md
Created September 30, 2019 08:31 — forked from gitaarik/git_submodules.md
Git Submodules basic explanation

Git Submodules basic explanation

Why submodules?

In Git you can add a submodule to a repository. This is basically a repository embedded in your main repository. This can be very useful. A couple of advantages of using submodules:

  • You can separate the code into different repositories.
@nechkin
nechkin / 1. siege.sh
Created September 19, 2019 09:34 — forked from Integralist/1. siege.sh
Siege load/stress testing utility (https://www.joedog.org/siege-manual/)
# brew install siege
# -c/--concurrent == number of concurrent requests
# -r/--reps == number of times to run the test
siege -c 10 -r 10 -b "http://www.domain.com/"
# Note: doesn't always work with SSL endpoints with self-signed certs
# using Apache Ab in a Docker container seems to do the trick though
# see https://gist.github.com/Integralist/01815f7abc7d18a97341
@nechkin
nechkin / wait_proc
Last active May 8, 2019 12:06
bash scripts wait for process to finish
#!/bin/bash
# script runs rabbit-init.jar waits 30 seconds for it to finish
# (wait time can be set with WAIT_TOTAL env property)
properties_location=$1
wait_pid() {
local pid="$1"; shift
local wait_total="${1:-10}"; shift # 10 seconds as default timeout
@nechkin
nechkin / test_ms_ready_k8s.pl
Created April 19, 2019 20:37
Perl script to test that pods are ready in kubernetes
#!/usr/local/bin/perl
use strict;
use YAML::Tiny;
my $maxAttempts = 60;
my $timeoutSeconds = 60;
# шаблон для команды получения списка Ready статусов для всех подов с заданым лейблом
my $separator = '\t';
my $jsonPath = '{range .items[*]}{@.metadata.name}{"'.$separator.'"}{@.status.conditions[?(@.type=="Ready")].status}{"\n"}{end}';
@nechkin
nechkin / JavaPuzzler01.java
Last active December 13, 2018 03:24
Java Puzzler 01 generic overload
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
/**
* Type is erase in bytecode, but which method to call is inferred at compile type, when generics are available
*/
class Scratch {
// can be called with Arrays.asList("a", "b"), type is inferred to String
@nechkin
nechkin / idea
Created October 27, 2018 16:56 — forked from chrisdarroch/idea
Open a project in IntelliJ IDEA from your command line!
#!/bin/sh
# check for where the latest version of IDEA is installed
IDEA=`ls -1d /Applications/IntelliJ\ * | tail -n1`
wd=`pwd`
# were we given a directory?
if [ -d "$1" ]; then
# echo "checking for things in the working dir given"
wd=`ls -1d "$1" | head -n1`
@nechkin
nechkin / wkhtmltopdf.tablesplit.js
Created October 13, 2016 11:08 — forked from niflostancu/wkhtmltopdf.tablesplit.js
WkHtmlToPdf Table Splitting Hack
/**
* WkHtmlToPdf table splitting hack.
*
* Script to automatically split multiple-pages-spanning HTML tables for PDF
* generation using webkit.
*
* To use, you must adjust pdfPage object's contents to reflect your PDF's
* page format.
* The tables you want to be automatically splitted when the page ends must
* have a class name of "splitForPrint" (can be changed).
#!/bin/sh
# Init script for kibana
# From Kibana package
# Generated by pleaserun.
# Implemented based on LSB Core 3.1:
# * Sections: 20.2, 20.3
#
### BEGIN INIT INFO
# Provides: kibana
# Required-Start: $remote_fs $syslog
user="root"
group="root"
chroot="/"
chdir="/"
nice=""