This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Illuminate\Database\PostgresConnection as Connection; | |
class DBTransaction | |
{ | |
/** | |
* Выполнение функкции в транзакции с возможностью указывать точки сохранения. | |
* - Если функция выполнится без ошибки (Exception), произойдёт полный коммит | |
* - Если функция выбросит исключение, то произойдёт коммит от начала до последнего вызовы `savepoint()` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE OR REPLACE FUNCTION log_tables_rotate(v_table_name text) | |
RETURNS boolean AS | |
$BODY$ | |
DECLARE | |
rec record; | |
rotate record; | |
last_rotation_end_date int; | |
rotate_period_time timestamp with time zone; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { runSaga } = require('redux-saga') | |
const { takeEvery, select } = require('redux-saga/effects') | |
const EventEmitter = require('events').EventEmitter | |
// | |
// Create Saga IO: | |
// | |
const createSagaIO = (emitter, getStateResolve) => ({ | |
// this will be used to resolve take Effects | |
subscribe: (callback) => { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT (ip - '0.0.0.0'::inet) as ip_integer |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
du --max-depth=1 / | sort -n -r |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rsync /src/ user@host:/dst/ --delete --itemize-changes --recursive --checksum --exclude='exclude.file' --dry-run | grep -vF '<f..T......' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function outputCSV(Application $app, array $recs, $filename) | |
{ | |
$stream = function() use ($recs) { | |
$output = fopen('php://output', 'w'); | |
foreach ($recs as $rec) | |
{ | |
fputcsv($output, $rec); | |
} | |
fclose($output); | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(echo google.com; echo yandex.ru; echo mail.ru) | xargs -I DOMAIN --max-procs=10 -n 1 nslookup DOMAIN | awk '/^Address: / { print $2 }; /^Name/ { print $2 }' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
echo -e "GET /some-path HTTP/1.0\nHost: 127.0.0.1\n\n" | telnet 127.0.0.1 80 |