Skip to content

Instantly share code, notes, and snippets.

@drbyte
drbyte / .bash_aliases.sh
Last active August 29, 2015 14:27 — forked from michaelsbradleyjr/.bash_aliases.sh
Some helpful docker aliases
# GNU parallel
# better than xargs: http://www.gnu.org/software/parallel/
# install: (wget -O - pi.dk/3 || curl pi.dk/3/) | bash && \
# echo will cite | parallel --bibtex
command -v parallel &>/dev/null
if [ $? != 0 ]; then
alias para='xargs'
else
alias para='parallel'
fi
@drbyte
drbyte / Convert line-endings to DOS-style
Created May 6, 2015 18:06
Convert line-endings to DOS-style
perl -pe ’s/\r\n|\n|\r/\r\n/g’ source.txt > dest.txt
@drbyte
drbyte / Regex patterns to detect old PHP code.txt
Last active September 4, 2021 21:40
Regex patterns to detect old PHP code
Find each() and create_function() calls >= PHP 7.2
=(\W)?(each|create_function) ?\(
(or look for the while/list/each construct):
while\W?\(\W?list\W?\(.*=\W?each\(
Find all SHORT tags >= 5.3
(.*)<\?(?!(p|x|=))(.*)
@drbyte
drbyte / class.limitCartValue.php
Created May 13, 2014 19:23
Limit cart contents to max $1million (for ZC v1.3.9h)
<?php
/**
* This file should be uploaded as: /includes/classes/observers/class.limitCartValue.php
* It also requires that the config.limitCartValue.php file also be installed. See below.
* Limit shopping cart total value, to mitigate against DDOS attacks
*/
class limitCartValue extends base {
/** constructor method
* Attach listeneners to events