Skip to content

Instantly share code, notes, and snippets.

View KarelWintersky's full-sized avatar

Karel Wintersky KarelWintersky

View GitHub Profile

1. Clone your fork:

git clone git@github.com:YOUR-USERNAME/YOUR-FORKED-REPO.git

2. Add remote from original repository in your forked repository:

cd into/cloned/fork-repo
git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git
git fetch upstream
@KarelWintersky
KarelWintersky / standalone_counter.php
Created January 10, 2018 21:18
Standalone simple hit counter
<?php
// вызывается как standalone_counter.php?id=N
// по умолчанию (если id опущен) - принимается равным 1
function getRealIP() {
$ip = '127.0.0.1';
if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
$ip = $_SERVER['HTTP_CLIENT_IP'];
} elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
$ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
@KarelWintersky
KarelWintersky / two middleware calls.md
Created October 2, 2017 16:20
Two middleware calls

routes/web.php

use App\Http\Middleware\CheckAge;

Route::get('users/{id}', function($id) {

})->middleware(CheckAge::class);
@KarelWintersky
KarelWintersky / bootstrap-vertical-grid.css
Created September 28, 2017 22:55 — forked from cmcraducu/bootstrap-vertical-grid.css
Bootstrap vertical grid. For laying out full-screen fixed height webapps.
.container-fixed {
bottom: 0;
position: fixed;
left: 0;
right: 0;
top: 0;
}
.container-fixed .col {
height: 100%;
@KarelWintersky
KarelWintersky / hash.php
Created September 26, 2017 02:48
PHP HASH algorithms comparsion
<?php
/**
* User: Arris
* Date: 21.09.2017, time: 0:35
*/
const TEST_COUNT = 1000000;
const SOURCE = 'Тестируем построение хэша php с помощью стандартной библиотеки HASH::';
function TESTER( $testing_function, $argument )
{
@KarelWintersky
KarelWintersky / osslcrypt.php
Last active September 20, 2017 23:49
openssl_encrypt() cyphers testing comparsion
<?php
/**
* User: Arris
* Date: 21.09.2017, time: 0:35
*/
const TEST_COUNT = 100000;
const SOURCE = 'Тестируем обратимое шифрование на php';
const KEY = "password";
function TESTER( $testing_function, $argument )
@KarelWintersky
KarelWintersky / banner.php
Created September 5, 2017 11:49
Пример реализации баннера для тестового задания
<?php
// здесь id_banner всегда 1
function getRealIP()
{
if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
$ip = $_SERVER['HTTP_CLIENT_IP'];
} elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
$ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
} else {
@KarelWintersky
KarelWintersky / gist:620390b5c1a83893d4e525c112b6e595
Created July 14, 2017 14:30
Backup MySQL to YandexDisk (OAuth)
#!/bin/bash
#
# # # # # # # # # # НАСТРОЙКИ ДОСТУПА К MYSQL # # # # # # # # # #
MYSQL_SERVER=localhost
MYSQL_USER=root
MYSQL_PASSWORD=password
MYSQL_DATABASES="--all-databases"
# Yandex.Disk настройки (как получить - см. https://oauth.yandex.ru/ и https://oauth.yandex.ru/authorize?response_type=token&client_id=?)
@KarelWintersky
KarelWintersky / bench.php
Last active June 11, 2017 12:07
PHP Benchmark Performance Script v1.0.6
#!/usr/bin/php
<?php
/*
##########################################################################
# PHP Benchmark Performance Script #
# © 2010 Code24 BV #
# #
# Author : Alessandro Torrisi #
# Author : Sergey Dryabzhinsky #
# Company : Code24 BV, The Netherlands #
@KarelWintersky
KarelWintersky / mkstage4.sh
Created June 1, 2017 22:54
Backup script for Gentoo Linux
#!/bin/bash
# Backup script for Gentoo Linux
# Copyright Reto Glauser aka Blinkeye
# Distributed under the terms of the GNU General Public License v2
# Mailto: stage4 at blinkeye dot ch
# Forum post: http://forums.gentoo.org/viewtopic-t-312817.html
# Date: 2005-06-30
version=v3.5
basename=`basename $0`