Skip to content

Instantly share code, notes, and snippets.

View rocwang's full-sized avatar

Roc Wong rocwang

View GitHub Profile
@rocwang
rocwang / magento-email-test.php
Created September 9, 2015 05:00
Magento email test script.
<?php
require_once '../abstract.php';
class MR_Emailtest extends Mage_Shell_Abstract
{
/**
* Retrieve Usage Help Message
*
* @return string
*/
@rocwang
rocwang / generate.sh
Last active November 28, 2015 09:08
Generate HTML snippet for Photoswipe by using "identify"
identify -format '<div class="gallery__col js-gallery__col">\n<a href="img/prev-conf/%f" class="gallery__link js-gallery__link" data-width="%w" data-height="%h">\n<img src="img/prev-conf/%f" alt="Previous Conference" class="gallery__img js-gallery__img">\n</a>\n</div>\n\n' *
@rocwang
rocwang / docker-clean.sh
Last active December 22, 2022 02:22
Remove all Docker containers and unused images and volumes
#!/bin/bash
#Remove all Docker containers and unused images and volumes
docker ps -qa|xargs docker rm -f
docker images |grep '<none>'|awk '{print $3}'|xargs docker rmi
docker volume ls -qf dangling=true|xargs docker volume rm
@rocwang
rocwang / create-db.sql
Created April 27, 2016 22:42
Create database with UTF*
CREATE DATABASE `mydb` CHARACTER SET utf8 COLLATE utf8_general_ci;
@rocwang
rocwang / wallpaper.shell
Last active October 1, 2018 08:30
Update wallpaper from Interfacelift for Linux
#!/bin/bash
################################################################################
# Wallpaper Updater #
# #
# Automatically update wallpaper from "interfacelift.com". Only for GNOME2 #
# #
# --Roc 2008-03-18 #
################################################################################
RSS_FILE=`tempfile`

How to create a trusted local SSL certificate

Slate v1.0 uses a local express server and serve most of your assets from https://localhost:8080. It's a good idea to create a trusted SSL certificate on your device so localhost assets served via https are never blocked.

ⓘ The below steps probably only work in MacOS.

  1. Copy and paste the command below into your terminal to navigate to your home directory, create a folder called .localhost_ssl, and then navigate to that folder:
cd &amp;&amp; mkdir .localhost_ssl &amp;&amp; cd .localhost_ssl
@rocwang
rocwang / mage-errors-exceptions.sh
Created March 26, 2018 20:50
Top Magento errors & exceptions
cut -d' ' -f 2- var/log/system.log |sort|uniq -c|sort -rn|head
grep exception var/log/exception.log |sort|uniq -c|sort -nr|head
@rocwang
rocwang / clear-appointments.sql
Created March 26, 2018 20:51
Clear Booked appointments in WordPress
delete from wp_posts where post_type="revision";
delete from wp_posts where post_type="booked_appointments";
delete from wp_postmeta where post_id not in (select ID from wp_posts);
@rocwang
rocwang / print-bg.css
Created March 26, 2018 20:56
Forcing to print background using CSS
/* To force backgrounds to be printed (can be useful when you "print" a pdf),
* add this CSS (compatible with Safari and Chrome) */
html {
-webkit-print-color-adjust: exact;
print-color-adjust: exact;
}
@rocwang
rocwang / mage-upgrade.md
Created March 26, 2018 20:57
Magento upgrade steps

Magento upgrade steps

  1. Upgrade via Magento connect
  2. Check app/code/core overwrite
  3. Check design/adminhtml overwrite
  4. Reenable Cm_RedisSession if necessary
  5. Reenable Mage_XmlConnect if necessary
  6. Restore favicon
  7. chmod +x mage
  8. Check rewrite conflicts