Skip to content

Instantly share code, notes, and snippets.

View fedek6's full-sized avatar
🎯
Focusing

Konrad Fedorczyk fedek6

🎯
Focusing
View GitHub Profile
@fedek6
fedek6 / remove_old_log_entries.sql
Last active August 21, 2018 13:19
Log rotation in MySQL table
DELETE FROM logs WHERE id IN (select id from (select id FROM log ORDER BY id DESC LIMIT 1000, 500) x)
@fedek6
fedek6 / .user.ini
Created July 27, 2018 12:12
Simple PHP large upload test script
upload_max_filesize = 2048M
post_max_size = 2048M
max_input_time = 3600
@fedek6
fedek6 / web.config
Created June 19, 2018 15:37
Force https on IIS
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Force HTTPS" stopProcessing="true">
<match url="^(.*)$" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false">
<add input="{HTTPS}" pattern="^OFF$" />
</conditions>
@fedek6
fedek6 / matomo.bat
Created June 6, 2018 16:13
Automatic log parsing for matomo using Bat
@echo off
:: Based on https://matomo.org/docs/log-analytics-tool-how-to/
:: Global config
SET PY_BIN=C:\Program Files\Python\Python27\python.exe
SET IMPORT_LOGS=[path to matomo]\piwik\misc\log-analytics\import_logs.py
SET LOGS_DIR=C:\inetpub\logs\LogFiles
SET TOKEN=****************************
SET URL=http://website.com/piwik/
SET THREADS=2
@fedek6
fedek6 / parse_logs.ps1
Last active February 25, 2020 21:10
Parse logs for Matomo (Piwik) on Windows [using Powershell]
#Based on https://matomo.org/docs/log-analytics-tool-how-to/
#------------------------------------------------------------------------
# Config
#:: Python URL (must be 2.x)
$PY_BIN="C:\Program Files\Python\Python27\python.exe"
#:: Matomo import_logs executable
$IMPORT_LOGS="[path_to_piwik]\piwik\misc\log-analytics\import_logs.py"
@fedek6
fedek6 / import_logs.bat
Created June 5, 2018 12:39
Bat for importing Matomo logs on Windows enviroment.
@echo off
:: Based on https://matomo.org/docs/log-analytics-tool-how-to/
:: Global config
:: Python URL (must be 2.x)
SET PY_BIN=C:\Program Files\Python\Python27\python.exe
:: Matomo import_logs executable
SET IMPORT_LOGS=C:\inetpub\htdocs\piwik\misc\log-analytics\import_logs.py
@fedek6
fedek6 / backup_pg.ps1
Created June 4, 2018 12:20
PowerShell script for Posgres backup. Support for multiple databases.
#Global config (always uncommented)
$PG_BIN = "C:\Program Files\PostgreSQL\9.6\bin\pg_dump.exe"
$PG_HOST=$env:COMPUTERNAME
$PG_PORT=5432
$PG_PATH="C:\inetpub\temporary_backups"
$ZIP_BIN="C:\Program Files\7-Zip\7z.exe"
#----------------------------------------
#Database config for (uncomment if manual use)
@fedek6
fedek6 / bootstrap.js
Created May 21, 2018 12:41
jQuery basic bootstrap
(function ($, root, undefined) {
/**
* Onready – fire when DOM is ready
*/
$(function () {
'use strict';
// say hello
console.log('Hello, Want to hire me? Go to: http://realhe.ro');
@fedek6
fedek6 / web.php
Created May 21, 2018 09:57
Debug information about rendered template in Yii2
<?php
$config = [
'components' => [
'view' => [
'on afterRender' => function ($event) {
// Check if this is not a layout file
if( preg_match( '/layouts/', $event->viewFile ) == 0 ) {
/**
* Add template info.
*/
@fedek6
fedek6 / glitcher.js
Created May 14, 2018 10:16
Glitch website using jQuery
$.fn.glitchMode = function() {
var glitches = {
/**
* Random color
*/
color: function(e) {
var color ='#'+Math.random().toString(16).substr(2,6);
e.css('color', color );
},