Skip to content

Instantly share code, notes, and snippets.

View RusAlex's full-sized avatar

Alexander Pletnev RusAlex

View GitHub Profile
# setxkbmap -layout us,ru -variant 'colemak,,' -option "grp:lwin_toggle" -option "ctrl:nocaps"
# setxkbmap -option "ctrl:swapcaps"
# sms https://gist.github.com/RusAlex/0d24f9717e889c9599123635b25ac01d
# https://gist.github.com/RusAlex/303989e114aabeb0c5871aae69f63dec
# emacs https://gist.github.com/RusAlex/55732501306cfbfaabd86aa18f1a20b1
#set-window-option -g mode-keys vi
set-window-option -g automatic-rename off
bind j select-pane -L

Keybase proof

I hereby claim:

  • I am rusalex on github.
  • I am rusalex (https://keybase.io/rusalex) on keybase.
  • I have a public key ASCzZ63iDjUP9-dJBSKkImt-ONG_BTReq3eAzCMTgT-UIwo

To claim this, I am signing this object:

17-Jun-01 - 17-Jun-30 Liabilities:Tax:Advance 56.90 EUR 56.90 EUR
Liabilities:Tax:Employee:Health 18.58 EUR 75.48 EUR
Liabilities:Tax:Employee:Parental 0.29 EUR 75.77 EUR
Liabilities:Tax:Employee:Pension 45.29 EUR 121.06 EUR
Liabilities:Tax:Employee:Unenployment 0.41 EUR 121.47 EUR
<?php
require 'vendor/autoload.php';
use \App\TestController;
$x = new TestController;
$app = new \Slim\App;
$app->get('/hello/{name}', \App\TestController::class.':testAction');
let storage = [];
let tmpObject = {};
module.exports = {
refresh: function (functionNames, modificationDates) {
for (let i = 0; i < functionNames.length; i++) {
tmpObject[functionNames[i]] = modificationDates[i];
}
var p1 = new Promise(function(resolve, reject) {
console.log('resolving');
resolve('Success!');
});
setTimeout(() => {
p1.then(function(value) {
console.log(value); // Success!
}, function(reason) {
console.log(reason); // Error!

Redux folders

  • actions Action simple functions with payloads of information to change state. http://redux.js.org/docs/basics/Actions.html#actions
  • store folder with reducers and store initialization code. Reducers: http://redux.js.org/docs/basics/Reducers.html#reducers
  • stages or pages folder of "smart" react views. Views that connected to store with react-redux and their markup JSX. In redux terms files from the folder by default will return "redux containers". http://redux.js.org/docs/basics/UsageWithReact.html#container-components
  • components or views dumb views like Buttons or Text views.
  • selectors functions return part of store to connect with "smart" components. This is not a dogma and simple selectors can be also defined in stages/pages component files. Only one case when you create file in this folder, when you use the same part of app state in several stages/pages.
  • api - ...
  • triggers - service to that stays between stages/pages and api. It may decide where to

Что нового в PHP 7.1 ?

https://wiki.php.net/rfc/nullable_types

Самое необходимое. Как только мы в комании начали использовать PHP 7.x, return type declaration стал строгим правилом. На примере какого-нибудь геттера модели можно встретиться что если свойство равно NULL то и return type declaration строгое правило сработает и вызовет ошибку.

Simple load monitoring

First time I met task to monitor the server load. It is time when I started to think about how long I wont need new server? or Will I know when my users will start suffering from site load latency?.

I wanted to know precisely answers to my questions. Therefore started with few simple steps: log server avg load data every minute and visualize this data.

@RusAlex
RusAlex / incremental-backups-percona-xtrabackup.sh
Created July 9, 2016 11:53 — forked from etagwerker/incremental-backups-percona-xtrabackup.sh
Bash script to perform MySQL incremental backups with Percona xtrabackup with Cron, starting with a full backup.
STAMP=`date +%Y%m%d%H%M`
echo "Iniciando backup @ $STAMP"
mkdir -p /var/backups/$STAMP
LAST_DIR=`ls /var/backups/inc | sort -n | tail -1`
xtrabackup --use-memory=1G --backup --target-dir=/var/backups/inc/$STAMP --incremental-basedir=/var/backups/inc/$LAST_DIR --user=root --password=<root-password>
echo "Fin backup @ $STAMP"