Skip to content

Instantly share code, notes, and snippets.

Avatar

Steve Robbins steverobbins

View GitHub Profile
View obfuscate-php.sh
#!/bin/bash
if [ -z "$1" ]; then
DIR=`pwd`
else
DIR=$1
fi
echo Beginning obfuscation... Hope you made copies, originals will be lost
@steverobbins
steverobbins / watchsize.sh
Last active Aug 29, 2015
Monitors a file's size and alerts you when it's stopped growing (useful if you need to wait for a long logging process to finish)
View watchsize.sh
#!/bin/bash
if [ -z $1 ]
then
echo "Usage: watchsize <file>"
exit
fi
SIZELAST=0
SIZENOW=1
View ps1
#!/bin/bash
bash_prompt() {
local NONE="\[\033[0m\]" # unsets color to term's fg color
# regular colors
local K="\[\033[0;30m\]" # black
local R="\[\033[0;31m\]" # red
local G="\[\033[0;32m\]" # green
local Y="\[\033[0;33m\]" # yellow
View mac-motd
#!/bin/bash
dynmotd () {
local NONE="\033[0m" # unsets color to term's fg color
# regular colors
local K="\033[0;30m" # black
local R="\033[0;31m" # red
local G="\033[0;32m" # green
local Y="\033[0;33m" # yellow
View magento-visitor-analytics.sql
-- Totals per month
select
s.name `Store View`,
date_format(u.visit_time, "%Y-%m") Period,
count(distinct vi.remote_addr) `Unique Visits`,
sum(vi.http_user_agent regexp 'bot|spider|w3c|validat|crawl|monitor|php') `Total Visits from Bots`,
count(*) `Total Visits` -- Warning: slow
from log_url u
inner join log_visitor_info vi
on vi.visitor_id = u.visitor_id
View magento-copy-cms-to-store-view.sql
set @STORE_TO_COPY_FROM = 2;
set @STORE_TO_COPY_TO = 3;
insert ignore into cms_block_store
select block_id, @STORE_TO_COPY_TO
from cms_block_store
where store_id = @STORE_TO_COPY_FROM;
insert ignore into cms_page_store
select page_id, @STORE_TO_COPY_TO
View magento-bundle-products-with-required-options-but-no-default.sql
select o.parent_id bundle_product_id, s.option_id, o.required is_required, (
select if(count(*) > 0, 'yes', 'no')
from catalog_product_bundle_selection s2
where s2.option_id = option_id
and s2.parent_product_id = s.parent_product_id
and is_default = 1
) has_default, count(selection_id) num_of_bundle_options
from catalog_product_bundle_option o
inner join catalog_product_bundle_selection s
on s.parent_product_id = o.parent_id
View magento-best-sellers.sql
select sfoi.sku, sum(sfoi.qty_ordered) sold, sum(sfoi.base_price) dollaramount
from sales_flat_order_item sfoi
group by sfoi.sku
order by sold desc
View magento-gitignore
# Magento
/app/etc/local.xml
/connect/package.xml
/downloader/.cache
/downloader/cache.cfg
/downloader/connect.cfg
/media
/robots.txt
/sitemap.xml
/var/*
@steverobbins
steverobbins / mamp-httpd.conf
Last active Aug 29, 2015
/Applications/MAMP/conf/apache/httpd.conf
View mamp-httpd.conf
NameVirtualHost *
<VirtualHost *>
DocumentRoot "/Applications/MAMP/htdocs"
ServerName localhost
</VirtualHost>
<VirtualHost *>
ServerName 127.0.0.1.xip.io
UseCanonicalName Off
ServerAlias *.127.0.0.1.xip.io
<Directory />