Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View petskratt's full-sized avatar

Peeter Marvet petskratt

View GitHub Profile
@petskratt
petskratt / dumb-sec.php
Created May 15, 2021 08:43
Really dumb idea
<?php
/**
* A really dumb tool for ad-hoc PHP request logging - mostly useful to find malicious POST / cookie / etc payloads
*
* prepend with php.ini or .user.ini to cover all requests:
* auto_prepend_file = /[full-path-to-location]/dumb_sec.php
*
* @author : Peeter Marvet (peeter@zone.ee)
* @version 0.3
* @license https://www.gnu.org/licenses/gpl-3.0.html GPL
@petskratt
petskratt / wow_much_openssl.sh
Created November 1, 2022 19:29
Scan images deployed to a K8S cluster for OpenSSL versions
#!/usr/bin/env bash
# peeter.marvet@vaimo.com / 2022-11-01 ("Klytus, I'm bored. What plaything can you offer me today?")
# Scan images deployed to a K8S cluster for OpenSSL versions
#
# prerequisites:
# - kubectl
# - authenticated and authorised to access all namespaces of a cluster
# - Trivy installed https://aquasecurity.github.io/trivy/v0.34/getting-started/installation/
# - Trivy has access to your presumably private registries https://aquasecurity.github.io/trivy/v0.34/docs/advanced/private-registries/gcr/
#
@petskratt
petskratt / robots.txt
Last active March 5, 2023 16:03
Magento robots.txt
# robots.txt for Magento 1.9.x & 2.x / v1.7 2023-01-30 / peeter.marvet@vaimo.com
# - original version from 2015 for 1.9.x, but these rules are OK for M2 as well
# - edited in 2017 to add filter query parameter disallow samples + some wildcards
# - edited in 2018 to add query params blocking to Yandex as named User-agent does not read *
# - edited in 2023 to remove unneeded stuff (license.txt, crawl-delay) and make all rules use */ prefix
# based on:
# https://inchoo.net/ecommerce/ultimate-magento-robots-txt-file-examples/
# https://www.hypernode.com/nl/blog/magento-robots-txt/
# https://astrio.net/blog/optimize-robots-txt-for-magento/
#
@petskratt
petskratt / xkcd_pwd_gen.php
Last active March 20, 2023 15:17
Generate xkcd style password using most common 1000 Estonian words (Ansip and Savisaar excluded)
<?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() {
@petskratt
petskratt / curltime.sh
Created April 27, 2023 07:36
curltime and curloop
#!/usr/bin/env bash
# should go into .profile
#
# single timing:
# curltime https://example.com/
#
# with unique query argument to bypass cache:
# curltime https://example.com/?cachebuster=202304271033
#
# loop with increasing counter:
@petskratt
petskratt / aliases.sh
Created April 27, 2023 07:53
aliases à la Zone.eu
#!/usr/bin/env bash
# should go into .profile
# from zone.eu shared server conf, with changes for MacOS
alias ..='cd ..'
alias ...='cd ../..'
alias ....='cd ../../..'
alias cd..='cd ..'
alias cd...='cd ../..'
alias cd....='cd ../../..'
# Display current K8S resource usage for a namespace (either first argument or current)
# Add to your ~/.profile, copy-paste results for analysis to https://docs.google.com/spreadsheets/d/1v___k9gYo4RI4wWIluJcdqOVHCFEccLQMOCGxvrZGtk/edit?usp=sharing
# peeter.marvet@vaimo.com / 2023-07-18
function resource_capacity() {
if [ -z "$1" ]
then
namespace=$(kubectl config view --minify -o jsonpath='{..namespace}')
else
@petskratt
petskratt / clinup
Last active March 12, 2024 23:21
Use wp-cli to clean up WordPress installs (force core & plugins reinstall, track changes in git allowing easy reverts etc)
#!/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 / .gitignore
Last active March 30, 2024 15:02
Group file change times by inode ctime
.Idea
.DS_Store