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 / 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 / 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 / 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 / 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 / .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 / 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 / Controller.php
Created December 3, 2018 12:39
Prepend application name to site title in Yii2
<?php
/**
* Extension of base controller.
* Add additional controller functions and vars here.
*/
namespace app\components;
use Yii;
@fedek6
fedek6 / selfpacker.sh
Created December 21, 2018 21:16
Packager for web projects on nix systems.
#!/bin/sh
# Extract JSON value
parse_json () {
echo $1 | \
sed -e 's/[{}]/''/g' | \
sed -e 's/", "/'\",\"'/g' | \
sed -e 's/" ,"/'\",\"'/g' | \
sed -e 's/" , "/'\",\"'/g' | \
sed -e 's/","/'\"---SEPERATOR---\"'/g' | \
@fedek6
fedek6 / page-test.php
Created June 7, 2019 08:25
szablon testowy WP
<?php
/*
* Template Name: Szablon testowy
*/
// taka prościzna do mierzenia czasu wykonania
function timeTook($start, $task = '') {
$execution_time = round( (microtime(true) - $start), 2);
return '<h4>Zadanie: <em>' . $task . '</em> zajęło: ' . $execution_time . ' sekund(y)</h4>';
}
@fedek6
fedek6 / zippacker.sh
Created June 24, 2019 18:51
Packer for web projects. It will pack public dir in current path. Archive name will include info from package.json.
#!/bin/sh
# Extract JSON value
parse_json () {
echo $1 | \
sed -e 's/[{}]/''/g' | \
sed -e 's/", "/'\",\"'/g' | \
sed -e 's/" ,"/'\",\"'/g' | \
sed -e 's/" , "/'\",\"'/g' | \
sed -e 's/","/'\"---SEPERATOR---\"'/g' | \