Skip to content

Instantly share code, notes, and snippets.

View joshfedo's full-sized avatar

Joshua fedoryszyn joshfedo

  • Binary Anvil
  • Missouri
View GitHub Profile
@JeremyKennedy
JeremyKennedy / pa_cal.cfg
Last active June 20, 2024 23:48
Klipper Pressure Advance Line Calibration Macro
[gcode_macro PA_CAL]
# Klipper pressure advance line calibration macro.
# Usage: PA_CAL BED=100 NOZZLE=240 PA_START=0.0 PA_STOP=0.1 NZL=0.4
# Or you can execute with no parameters, which will use values from printer.cfg and saved_variables.cfg.
# First prints a line with current set PA, then prints 21 additional line segments starting with PA_START, and increasing to PA_STOP.
# Based on http://realdeuce.github.io/Voron/PA/pressure_advance.html
# Cleaned up and moved to using saved_variables.cfg by u/jibbsisme
# Sourced from u/Deepsiks, assisted by u/imoftendisgruntled, u/scul86, and thanks to u/beansisfat, u/stray_r
description: Tune Pressure Advance
@mttjohnson
mttjohnson / search_db_for_string.sql
Last active May 26, 2021 19:08
MySQL Search Entire DB for String
-- Be careful using this on large or on servers with production databases, it could take a long time, and is very invasive to performance.
-- Example, searching a 6GB Magento database on an idle dedicated server took 2 minutes.
set @search = 'my_search_text';
set @database = 'database_name';
select CONCAT('select \'', tbl.`TABLE_NAME`,'\' as TableName, \'', col.`COLUMN_NAME`,'\' as Col, `',col.`COLUMN_NAME`,'` as value from ' ,@database, '.`' , tbl.`TABLE_NAME`,'` where `' ,
col.`COLUMN_NAME` , '` like \'%' ,@search, '%\' UNION') AS q
from information_schema.`tables` tbl
inner join information_schema.`columns` col on tbl.TABLE_SCHEMA = col.TABLE_SCHEMA and tbl.`TABLE_NAME` = col.`TABLE_NAME`and (col.DATA_TYPE='varchar' or col.DATA_TYPE='text')
@chris-huffman
chris-huffman / setup_sourceguardian.sh
Last active January 26, 2024 18:11
Install source guardian for PHP 7.2
#Run the following commands to install SourceGuardian Loader
#The example below is for PHP 7.2. Please use the version that applies to your situation.
sudo su
mkdir /usr/local/sourceguardian
cd /usr/local/sourceguardian
curl https://www.sourceguardian.com/loaders/download/loaders.linux-x86_64.tar.gz --output loaders.linux-x86_64.tar.gz
tar xzf loaders.linux-x86_64.tar.gz
cp ixed.7.2.lin /usr/lib64/php/modules/
@sjb9774
sjb9774 / elasticsearch.sh
Last active February 25, 2021 21:11
ElasticSearch CURL Commands
ES_HOST='elasticsearch-host' # for example 127.0.0.1
ES_PORT='elasticsearch-port' # default 9200
# get indices
curl $ES_HOST:$ES_PORT/_cat/indices
ES_INDEX='index-name'
# get first 5 results from empty
curl $ES_HOST:$ES_PORT/$ES_INDEX/_search | jq .
@chris-huffman
chris-huffman / cli_debugging.sh
Last active January 22, 2021 20:29
Debugging from Vagrant CLI
# Generic example
export PHP_IDE_CONFIG="serverName=<host.lan>" && php -d xdebug.remote_autostart=on -f <somefile>.php -- <any PHP file CLI arguments>
# bin/magento example
export PHP_IDE_CONFIG="serverName=<host.lan>" && php -d xdebug.remote_autostart=on -f bin/magento -- <bin:magento:command> <any bin/magento command line arguments>
#### OLD WAY ####
@mttjohnson
mttjohnson / file-research.sh
Last active September 26, 2023 16:36
file recursive research
# find the biggest .png files in a sub directory
# referenced from https://www.cyberciti.biz/faq/how-do-i-find-the-largest-filesdirectories-on-a-linuxunixbsd-filesystem/
find . -type f -iname "*.png" -printf '%s %p\n'| sort -nr | head -25
# List all symlinks recursively in a directory
find ./ -type l -printf "%p -> %l\n"
find . -type l -ls
# List all broken symlinks