Skip to content

Instantly share code, notes, and snippets.

@ifnull
ifnull / view.html
Created June 6, 2015 00:01
Magento — Add Pinterest button
<!-- template/catalog/product/view.phtml -->
<!-- Pinterest Button -->
<?php
$_pinlink['url'] = $_product->getProductUrl();
$_pinlink['media'] = $_product->getImageUrl();
$_pinlink['description'] = $_product->getShortDescription();
?>
<a href="http://pinterest.com/pin/create/button/?<?php echo http_build_query($_pinlink) ?>" class="pin-it-button" count-layout="horizontal"></a>
<script type="text/javascript" src="//assets.pinterest.com/js/pinit.js"></script>
@ifnull
ifnull / snippet.html
Created May 1, 2015 22:24
PepperJam tracking for Dastmalchi_ConversionTracker Magento Extension
<!-- Pepperjam Tracker -->
<script>
function pepperJamPixel(){
var pid = 000000; // YOUR ID
var url = "https://t.pepperjamnetwork.com/track?";
var oid = "{{var order.getIncrementId()}}";
var discount = parseFloat({{var order.getDiscountAmount()}});
var subtotal = parseFloat({{var order.getSubtotal()}} + discount).toFixed(2);
@ifnull
ifnull / go.sh
Created April 30, 2015 21:02
Split large file
split -l 10000 ./import_coupon_codes.csv
@ifnull
ifnull / mage-coupon-cleaner.php
Created April 16, 2015 08:19
Iterate over Magento coupons to remove old coupons.
<?php
# Bootstrap
set_include_path(dirname(__FILE__) . PATH_SEPARATOR . get_include_path());
require 'app/Mage.php';
$app = Mage::app('', 'store');
$couponsCollection = Mage::getModel('salesrule/coupon')->getCollection();
Mage::getSingleton('core/resource_iterator')->walk(
$couponsCollection->getSelect(),
@ifnull
ifnull / fix_bad_unicode.py
Created March 25, 2015 04:24
Repair common Unicode mistakes after they've been made by Rob Speer
# -*- coding: utf-8 -*-
import unicodedata
def fix_bad_unicode(text):
u"""
Something you will find all over the place, in real-world text, is text
that's mistakenly encoded as utf-8, decoded in some ugly format like
latin-1 or even Windows codepage 1252, and encoded as utf-8 again.
@ifnull
ifnull / wunderadmin_checkbox_patch.diff
Created March 6, 2015 20:12
Patch for checkbox issue in wunderadmin
diff --git a/public_html/skin/adminhtml/default/wunderadmin/js/wunderadmin.js b/public_html/skin/adminhtml/default/wunderadmin/js/wunderadmin.js
index ae9d3da..ae2641a 100755
--- a/public_html/skin/adminhtml/default/wunderadmin/js/wunderadmin.js
+++ b/public_html/skin/adminhtml/default/wunderadmin/js/wunderadmin.js
@@ -36,6 +36,10 @@ if (typeof toggleValueElements != 'undefined')
var toggleValueElements = (function() {
var _toggleValueElements = toggleValueElements;
return function(checkbox, container, excludedElements, checked) {
+ if (typeof container == 'undefined') {
+ container = Element.previous(checkbox.parentNode.parentNode);
@ifnull
ifnull / README.md
Last active August 29, 2015 14:16
Setup nvidia cuda hashcat kali gfx 970

Instructions are for 346.47 driver but should work for newer when they are released. Check website for newer and use if available.

Setup SSH

apt-get install openssh-server
cd /etc/ssh/
mkdir old-keys
mv ssh_host_* old-keys/
update-rc.d -f ssh remove
@ifnull
ifnull / destroy.sql
Last active August 29, 2015 14:16
Removes all customer and sales data from Magento.
SET FOREIGN_KEY_CHECKS=0;
TRUNCATE TABLE sales_flat_quote;
TRUNCATE TABLE sales_flat_quote_item;
TRUNCATE TABLE sales_flat_quote_address;
TRUNCATE TABLE sales_flat_quote_address_item;
TRUNCATE TABLE sales_flat_quote_item_option;
TRUNCATE TABLE sales_flat_quote_payment;
TRUNCATE TABLE sales_flat_quote_shipping_rate;
TRUNCATE TABLE sales_flat_order;
TRUNCATE TABLE sales_flat_order_grid;
@ifnull
ifnull / iptables.sh
Created February 13, 2015 19:11
MySQL 3306 iptables rule
iptables -I INPUT -p tcp --dport 3306 -m state --state NEW,ESTABLISHED -j ACCEPT
iptables -I OUTPUT -p tcp --sport 3306 -m state --state ESTABLISHED -j ACCEPT
@ifnull
ifnull / run.sh
Created February 3, 2015 19:49
Convert Q-See DVR export to MP4 (DAV to MP4)
ffmpeg -y -i Home_Garage_main_20150130031041_20150130032415.dav -vcodec libx264 -crf 24 -vf scale=604:340 Home_Garage_main_20150130031041_20150130032415.mp4