Skip to content

Instantly share code, notes, and snippets.

@yesnik
yesnik / elasticsearch_docs.md
Last active July 25, 2023 13:19
Elasticsearch with Docker

Elasticsearch Docs

URL for Dev Tools: http://0.0.0.0:5601/app/dev_tools

Add data to Elasticsearch

You can add data to Elasticsearch by sending JSON objects (documents) to Elasticsearch over HTTP. Whether you have structured or unstructured text, numerical data, or geospatial data, Elasticsearch efficiently stores and indexes it in a way that supports fast searches.

@yesnik
yesnik / jquery.payment.js
Created August 1, 2020 05:54
jQuery Plugin on sberbank payment page for planeta.tc services
/**
* Payment page universal handler
*/
(function ($) {
jQuery.ajaxSettings.traditional = true; // https://forum.jquery.com/topic/jquery-post-1-4-1-is-appending-to-vars-when-posting-from-array-within-array
var settings = {
// name for orderId parameter
orderIdParam:"mdOrder",
language:"ru",
@yesnik
yesnik / dell_fix_audio.md
Last active December 21, 2023 15:08
Dell Vostro 5590 Ubuntu 20.04 audio not working

Dell Vostro 5590 Ubuntu 20.04 audio not working

After updating Ubuntu from 18.04 to 20.04 I have no sound on the notebook Dell Vostro 5590.

I completed these steps, reboot PC and sound problem was fixed:

  1. Purge Alsa and PulseAudio using the command:
sudo apt-get remove --purge alsa-base pulseaudio
@yesnik
yesnik / words_count.py
Created November 11, 2019 12:55
Python. Display the most frequent words in the text
# Free e-books: http://www.gutenberg.org/
file_name = 'dickens_charles_great_expectations.txt'
with open(file_name) as file_object:
words_count = {}
for line in file_object.readlines():
line_words = line.split(' ')
for word_raw in line_words:
word = word_raw.strip().lower()
@yesnik
yesnik / heidi_sql.md
Created October 22, 2019 12:24
HeidiSQL Reset Filters, Sorting on Data tab

HeidiSQL Reset Filters, Sorting on Data Tab

If you use HeidiSQL database manager, and can't open Data tab in this program because of sort or filter values, you can clear these saved values by editing Windows Registry:

  • Start regedit.exe
  • Delete the key/folder for the table, e.g.: HKEY_CURRENT_USER\Software\HeidiSQL\Servers\MyServer\databasename|tablename
@yesnik
yesnik / UniqueProcess.php
Created September 6, 2019 09:35
PHP Unique process
<?php
/**
* This class allows us to run only one instance of the process
*
* Example:
*
* $uniqueProcess = new UniqueProcess('/var/tmp/some_process_name.lock');
* if (!$uniqueProcess->begin()) {
* die();
@yesnik
yesnik / sheldon_crm_tasks.md
Last active June 3, 2019 09:46
Tasks for creating Sheldon CRM

Sheldon CRM Tasks

Dear programmer, I need your help to build a simple CRM named Sheldon CRM. Here you can find tasks that will help us to create it. You can use any programming language you want. All I want is a website with my Sheldon CRM.

1. Store partners

I have several partners. On our CRM website I need a page for creating new partners. Each partner has name and email. Also I need a page for editing each partner's information and a page where I can browse all partners' info.

@yesnik
yesnik / software_modification.md
Last active January 25, 2021 18:11
How to modify logic of software

How to modify logic of software

You have a client with a website. Client wants to add new feature or fix some bug.

Initial analysis

  • Listen carefully what client needs

  • Describe current logic that we need to modify. If logic is complex draw scheme on the sheet of paper. Don't describe details yet, forget about table names, class' names on this step.

@yesnik
yesnik / docker-compose.md
Last active April 26, 2024 05:32
Docker Guides

Docker Compose

Docker compose is a tool that is used for defining and running multi-container Docker apps in an easy way. It provides docker-compose.yml configuration file that can be used to bring up an app and the suite of services it depends on with just one command.

  • docker compose up - start all services from docker-compose.yml
  • docker compose up db - start only service db
  • docker compose up --build - rebuild all images and run containers
  • docker compose -f docker-compose.prod.yml up - start all services from docker-compose.prod.yml
@yesnik
yesnik / ubuntu.md
Last active August 4, 2018 11:49
Ubuntu Vurtualbox screen noise during installation

Ubuntu Vurtualbox screen noise during installation

I tried to install Ubuntu 18 on my Windows 10 PC using Virtualbox.

I saw problem with screen when I selected "Install Ubuntu on PC" item on the installation menu.

Solution: Just press this combinations of keys on your keyboard:

  1. Ctrl + Alt + F1
  2. Ctrl + Alt + F7