Skip to content

Instantly share code, notes, and snippets.

View reg2005's full-sized avatar
🏠
Working from home

Evgeniy reg2005

🏠
Working from home
View GitHub Profile
@reg2005
reg2005 / README.md
Last active March 30, 2021 05:32
How can you start developing pkg for AdonisJS 5?

How can you start developing npm package for AdonisJS 5?

It's simple - using mrm preset

  1. mkdir adonis-package-name && cd mkdir adonis-package-name
  2. npm init
  3. npm i --save-dev mrm @adonisjs/mrm-preset
  4. Add script to package.json file
{
 "scripts": {
 "mrm": "mrm --preset=@adonisjs/mrm-preset"
@sammchardy
sammchardy / binance-depth-cache-notes.txt
Last active September 25, 2022 10:36
Binance Depth Cache Notes
Ninj0r admin, [Oct 20, 2017, 9:18:55 AM]:
It's a three step process:
1) Start listening to the stream and buffering the messages
2) Get a depth snapshot
3) replay the buffered messages and the live messges.
Depth updates have two variables, u and U
U is the initial updateId, and u is the final updateId. There can be multiple updates "compressed" into a single update that comes out via the web socket stream.
@bouroo
bouroo / general.conf
Last active August 29, 2020 04:19
Configure a performance, secure, and stable NGINX server
# favicon.ico
location = /favicon.ico {
log_not_found off;
access_log off;
}
# robots.txt
location = /robots.txt {
log_not_found off;
access_log off;
@bastman
bastman / docker-cleanup-resources.md
Created March 31, 2016 05:55
docker cleanup guide: containers, images, volumes, networks

Docker - How to cleanup (unused) resources

Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...

delete volumes

// see: https://github.com/chadoe/docker-cleanup-volumes

$ docker volume rm $(docker volume ls -qf dangling=true)

$ docker volume ls -qf dangling=true | xargs -r docker volume rm

86937 isset
43159 echo
31697 empty
29252 substr
26146 count
24248 is_array
22572 strlen
19365 sprintf
18090 unset
16584 str_replace
@dmkuznetsov
dmkuznetsov / selectel.php
Created March 14, 2015 14:58
Selectel flysystem
<?php
use OpenCloud\OpenStack;
use League\Flysystem\Filesystem;
use League\Flysystem\Rackspace\RackspaceAdapter;
$client = new OpenStack('https://auth.selcdn.ru', [
'username' => '...',
'password' => '...'
]);
@greabock
greabock / ddd.md
Last active December 13, 2023 14:49
Как упороться по модульной структуре и областям ответсвенности в Laravel. А потом стать счастливым =)

#Как упороться по модульной структуре и областям ответственности в Laravel. А потом стать счастливым.

[UPD] после пары вопросов в личку, решил добавить дисклеймер: Я не считаю, что это единственно верный путь. Я просто говорю вам о том, что существует такой подход.

Когда меня спрашивают для чего нужны сервис-провайдеры в Laravel, я пожимаю плечами и говорю: если вы не знаете зачем они нужны, значит они вам не нужны. Если вы пишите и строите код так, как это описано во всех мануалах, скорее всего вам хватит одного провайдера на всё приложение, и он уже есть сразу. И не надо парить мозг себе и людям. Просто забейте на это все.

Дефолтная структура приложения на laravel выглядит вот так: У вас есть папка Http в которой лежат посредники(раньше это были фильтры) и контроллеры. Так же есть команды, хэндлеры, исключения, модели (последние Тейлор бессовестно бросил просто так - прямо в корне app )... возможно вы сами создаете папки репозиториев, обсерверов... или что-то там еще... потом вы начинаете строить

@dizda
dizda / install-bitcoind.sh
Last active July 18, 2022 06:41
Install bitcoind on debian wheezy
wget https://github.com/bitcoin/bitcoin/archive/v0.9.3.tar.gz
tar xvzf v0.9.3.tar.gz
mv bitcoin-0.9.3/ daemon/
apt-get install build-essential libtool autotools-dev autoconf libssl-dev libboost-all-dev pkg-config
# Get configure
./autogen.sh
# Enable hardening is more secure
@denji
denji / nginx-tuning.md
Last active May 1, 2024 22:58
NGINX tuning for best performance

Moved to git repository: https://github.com/denji/nginx-tuning

NGINX Tuning For Best Performance

For this configuration you can use web server you like, i decided, because i work mostly with it to use nginx.

Generally, properly configured nginx can handle up to 400K to 500K requests per second (clustered), most what i saw is 50K to 80K (non-clustered) requests per second and 30% CPU load, course, this was 2 x Intel Xeon with HyperThreading enabled, but it can work without problem on slower machines.

You must understand that this config is used in testing environment and not in production so you will need to find a way to implement most of those features best possible for your servers.

@reg2005
reg2005 / MY_URI.php
Last active December 16, 2015 03:29
This extension library 'URI' to Codeigniter, http://habrahabr.ru/post/42172/ Allows you to take off GET parameters after the '?' Is used when redirecting. russian: Это расширение библиотеки URI для COdeigniter, взято мной тут http://habrahabr.ru/post/42172/ Позволяет при выключенном GET принимать параметры после ?, использую при редиректе.
<?php
if (!defined('BASEPATH')) exit('No direct script access allowed');
/* Автор: t1myrkq http://habrahabr.ru/users/t1myrkq/
* Это расширение библиотеки URI для COdeigniter, взято мной тут http://habrahabr.ru/post/42172/
* Очень полезная вещь, если делать поиск POST запросом, формировать 301 redirect с адресом: ЧПУ+переменные на хвосте через знак вопроса (как у Get)
* Позволяет оставить '$config['enable_query_strings'] = FALSE;'. и принимать GET запросы командой $current_page = $this->uri->getParam(‘page’);
* где url /catalog/produnction/?page=2
* Почему не воспользоваться обычным GET? - потому-что при использовании редиректа в начало попадает знак вопроса и портит внешний вид ссылки
* Евгений Рюмин - beatlelab@gamil.com
* 12.04.2013