Skip to content

Instantly share code, notes, and snippets.

Peeter Marvet petskratt

Block or report user

Report or block petskratt

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@petskratt
petskratt / tables_and_indexes.sql
Last active Nov 22, 2018
List of all tables and indexes in db
View tables_and_indexes.sql
-- created to find tables with missing indexes on a WordPress install
SET @db = 'some_database';
SELECT
tbl.table_name,
idx.indexes
FROM
information_schema.tables AS tbl
LEFT JOIN(
SELECT table_name,
View zone-updateall.php
<?php
/*
Plugin Name: Zone Updateall
Plugin URI: https://gist.github.com/petskratt/1d3e29fb4e6224e1a73b2422c8363044
Description: Allow automatic WP and plugin updates. No fancy settings, just does the job.
Author: Peeter Marvet
Version: 0.1
Author URI: https://www.zone.ee/
*/
View zone-cachebuster.php
<?php
/*
Plugin Name: Zone Cachebuster
Plugin URI: https://gist.github.com/petskratt/3acd7166297ff4451a606115b49ad22c
Description: Replace JS and CSS version parameters with hash - for obfuscation or quick cachebusting.
Author: Peeter Marvet
Version: 0.1
Author URI: https://www.zone.ee/
*/
@petskratt
petskratt / clinup
Last active May 16, 2019
Use wp-cli to clean up WordPress installs (force core & plugins reinstall, track changes in git allowing easy reverts etc)
View clinup
#!/usr/bin/env bash
# for debug output, uncomment:
#set -x
function help {
echo "WordPress cleanup -v 0.5 2018-06-26 / peeter@zone.ee
Usage:
@petskratt
petskratt / humpty-dump.php
Created Nov 14, 2017
Humpty-dump - dump WP or Magneto 1.x database from PHP
View humpty-dump.php
<?php
// dump database - either using WordPress config from same directory or locally configured parameters
// ... or Magento's local.xml
// v 1.3 (2015-03-18) Peeter Marvet, http://tehnokratt.net
// v 1.4 (2017-11-14) added autorenamer
if ( basename( __FILE__, '.php' ) === 'humpty-dump' ) {
@petskratt
petskratt / .htaccess
Last active May 22, 2019
Perishable Press 6G firewall with slight modifications (archive.org bot enabled, no IP blocking part)
View .htaccess
# 6G FIREWALL/BLACKLIST
# @ https://perishablepress.com/6g/
# 6G:[QUERY STRINGS]
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{QUERY_STRING} (eval\() [NC,OR]
RewriteCond %{QUERY_STRING} (127\.0\.0\.1) [NC,OR]
RewriteCond %{QUERY_STRING} ([a-z0-9]{2000}) [NC,OR]
RewriteCond %{QUERY_STRING} (javascript:)(.*)(;) [NC,OR]
View nimbusec_explorer.php
<?php
/**
* Parse Nimbusec JSON raport
* User: petskratt (peeter@zone.ee)
* Date: 26.08.2016
* Time: 11:07
* v1.0
* - initial version (a quick hack and proof of idea)
*/
@petskratt
petskratt / .gitignore
Last active Oct 18, 2019
Group file change times by inode ctime
View .gitignore
.Idea
.DS_Store
View e-smaspaev.php
<?php
/**
* HTTP 1.1 vs HTTP/2 test
* User: petskratt
* Date: 06/05/16
* Time: 12:53
*/
$merchants = [
'kuivtoit.ee' => '/img/Kuivtoit2.jpg',
@petskratt
petskratt / xkcd_pwd_gen.php
Last active Aug 23, 2016
Generate xkcd style password using most common 1000 Estonian words (Ansip and Savisaar excluded)
View xkcd_pwd_gen.php
<?php
/*
* Generate xkcd style password using most common 1000 Estonian words (Ansip and Savisaar excluded)
* based on http://www.eki.ee/tarkvara/wordlist/soned2013_top1000.txt (removed names, countries, words with umlauts)
*
* http://xkcd.com/936/
*/
function xkcd_password_generator() {
You can’t perform that action at this time.