Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Konrad fedek6

🎯
Focusing
View GitHub Profile
@fedek6
fedek6 / .user.ini
Created Jul 27, 2018
Simple PHP large upload test script
View .user.ini
upload_max_filesize = 2048M
post_max_size = 2048M
max_input_time = 3600
@fedek6
fedek6 / functions.php
Created Mar 13, 2018
Ajax support for WP Newsletter plugin (https://www.thenewsletterplugin.com)
View functions.php
<?php
/** @constant string THEME_NAME **/
define( 'THEME_NAME', get_option('stylesheet') );
/**
* Custom script
*/
function my_scripts_method() {
wp_enqueue_script(
'custom-script',
@fedek6
fedek6 / parse_logs.ps1
Last active Feb 25, 2020
Parse logs for Matomo (Piwik) on Windows [using Powershell]
View parse_logs.ps1
#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 / removeSublimeContextMenu.bat
Created Nov 9, 2017
Remove Sublime integration added by: roundand/OpenWithSublimeText3.bat
View removeSublimeContextMenu.bat
@echo off
rem add it for all file types
@reg delete "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 3" /f
rem add it for folders
@reg delete "HKEY_CLASSES_ROOT\Folder\shell\Open with Sublime Text 3" /f
pause
@fedek6
fedek6 / keyboard.ino
Created Apr 11, 2017
Simple keyboard implementation for Arduino
View keyboard.ino
/**
* Arduino USB HID Keyboard Demo
* Keys 1, 2, 3 and 4 on pins 4, 5, 6 and 7
*
* @info check details on my website
* @link http://blog.realhe.ro
*/
uint8_t buf[8] = {
0 }; /* Keyboard report buffer */
@fedek6
fedek6 / between_dates.php
Created Jul 22, 2019
Do something between exact two dates in PHP
View between_dates.php
<?php
$showDate = "2019-07-16 20:00:00.0";
$hideDate = "2019-07-22 20:00:00.0";
$timezone = new DateTimeZone('Europe/Warsaw');
$now = new DateTime();
$now->setTimezone($timezone);
// If in timeframe
if( $now > new DateTime($showDate, $timezone) && $now < new DateTime($hideDate, $timezone) ) {
do_something();
@fedek6
fedek6 / zippacker.sh
Created Jun 24, 2019
Packer for web projects. It will pack public dir in current path. Archive name will include info from package.json.
View zippacker.sh
#!/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 Jun 7, 2019
szablon testowy WP
View page-test.php
<?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 / selfpacker.sh
Created Dec 21, 2018
Packager for web projects on nix systems.
View selfpacker.sh
#!/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 / Controller.php
Created Dec 3, 2018
Prepend application name to site title in Yii2
View Controller.php
<?php
/**
* Extension of base controller.
* Add additional controller functions and vars here.
*/
namespace app\components;
use Yii;
You can’t perform that action at this time.