Skip to content

Instantly share code, notes, and snippets.

@simongcc
simongcc / mount-clonezilla-image.txt
Created January 22, 2019 04:33
How to mount clonezilla image file
Credit to: gaebriel @ ubuntuforums.org
Reference:
https://ubuntuforums.org/showthread.php?t=872832
1. Prepare a large disk in Linux
2. Say if your image is /home/partimag/YOURIMAGE/, and the image is /home/partimag/YOURIMAGE/hda1.ntfs-img.aa, hda1.ntfs-img.ab...
run
"file /home/partimag/YOURIMAGE/hda1.ntfs-img.aa"
to see it's gzip, bzip or lzop image. Say it's gzip, then you can run
cat /home/partimag/YOURIMAGE/hda1.ntfs-img.* | gzip -d -c | ntfsclone --restore-image -o hda1.img -
@simongcc
simongcc / sass-config.bat
Created January 17, 2019 03:35
batch file for creating config.rb
@echo off
# create compass config.rb and necessary folders
set file=config.rb
set project=%1
set lang=tc
if not exist "_source" mkdir _source
if not exist "%project%/js" mkdir js
if not exist "%project%/%lang%/css" mkdir css
if not exist "%project%/%lang%/img" mkdir img
@simongcc
simongcc / config.rb
Created January 17, 2019 02:48
compass config example
# Since there are non-latin character inside JS/CSS in some cases
Encoding.default_external = "utf-8"
# Require any additional compass plugins here.
require 'compass/import-once/activate'
# Set this to the root of your project when deployed:
http_path = "/"
css_dir = "../PROJECT-NAME/webcms/templates/TEMPLATE-NAME/css"
sass_dir = "_source"
images_dir = "../PROJECT-NAME/webcms/templates/TEMPLATE-NAME/img"
@simongcc
simongcc / index.php
Created January 3, 2019 12:23 — forked from johndyer/index.php
Gutenberg Shortcode Block with Live Preview
<?php
/**
* Plugin Name: JD Gutenberg Shortcode Preview
* Description: Live shortcode previews in Gutenberg
* Author: johndyer
* Version: 1.0.0
*
*/
// Exit if accessed directly.
@simongcc
simongcc / enable_dnsmasq_on_osx
Created December 5, 2018 15:14
reference bash script for enabling DNSMasq on OSX
# bash <(curl -s https://gist.github.com/drye/5387341/raw/ec72cddfe43ec3d39c91a3c118cb68ab14a049f8/enable_dnsmasq_on_osx.sh)
# ----------------------
# installing dnsmasq and enable daemon
# ----------------------
brew install dnsmasq
sudo cp -v $(brew --prefix dnsmasq)/homebrew.mxcl.dnsmasq.plist /Library/LaunchDaemons
# ----------------------
# adding resolver for vbox domain
# ----------------------
@simongcc
simongcc / dnsmasq_sample.conf
Created December 5, 2018 13:55
DNDMasq config sample file
# Configuration file for dnsmasq.
#
# Format is one option per line, legal options are the same
# as the long options legal on the command line. See
# "/usr/local/sbin/dnsmasq --help" or "man 8 dnsmasq" for details.
# Listen on this specific port instead of the standard DNS port
# (53). Setting this to zero completely disables DNS function,
# leaving only DHCP and/or TFTP.
#port=5353
@simongcc
simongcc / Woocommerce-filter-placeholder.php
Created November 16, 2018 07:55
Change Woocommerce placeholder image
// reference: https://docs.woocommerce.com/document/change-the-placeholder-image/
/**
* Change the placeholder image
*/
function custom_woocommerce_placeholder_img_src( $src ) {
$upload_dir = wp_upload_dir();
$uploads = untrailingslashit( $upload_dir['baseurl'] );
$src = $uploads . '/assets/images/placeholder.png';
#!/usr/bin/env bash
echo
echo
if [ "$1" != "" ]; then
echo haha
echo You dropped $@
exit
else
echo haha
@simongcc
simongcc / mysql-notes.md
Last active July 8, 2020 08:10
mysql-notes
// to modify or add additional settings to vue-loader
const path = require('path')
extend (config) {
config.module.rules.forEach(elem => {
if (elem.loader === 'vue-loader') {
elem.options.loaders.scss.forEach(elem => {
if (elem.loader === 'sass-loader') {
const addPaths = [path.resolve(__dirname, 'node_modules')]
elem.options.includePaths = elem.options.includePaths == Array.isArray ? [].concat(elem.options.includePaths, addPaths) : addPaths