Skip to content

Instantly share code, notes, and snippets.

View lrkwz's full-sized avatar

Luca Orlandi lrkwz

View GitHub Profile
@lrkwz
lrkwz / liferay_backup.sh
Created September 15, 2011 08:26
Safe backup liferay.
#!/bin/bash
DBUSR=****
DBPWD=****
# You should be root
if [ "$(whoami)" != "root" ]; then
echo "Sorry, you are not root."
exit 1
fi
@lrkwz
lrkwz / whatismyip.sh
Created March 8, 2012 12:38
Your real ip as seen from outside world
#!/bin/bash
wget http://automation.whatismyip.com/n09230945.asp -O - -o /dev/nul
@lrkwz
lrkwz / projadd.bash
Created March 28, 2012 12:44
Create a new svn repository
#!/bin/bash
if [ -z "$1" ]; then
echo "Usage ./proj <project name>"
exit 2;
fi
if [ "$(whoami)" != "root" ]; then
echo "Sorry, you are not root."
exit 1
fi
@lrkwz
lrkwz / addtocart.phtml
Last active June 6, 2023 18:01
Magento quantity dropdown
<?php if ( Mage::getModel('cataloginventory/stock_item')->loadByProduct($_product)->getEnableQtyIncrements() ){ ?>
<select class="input-text qty" name="qty" id="qty">
<?php $i = (Mage::getModel('cataloginventory/stock_item')->loadByProduct($_product)->getMinSaleQty()?Mage::getModel('cataloginventory/stock_item')->loadByProduct($_product)->getMinSaleQty():1); ?>
<?php do { ?>
<option value="<?php echo $i?>">
<?php echo $i?>
<?php $i+= Mage::getModel('cataloginventory/stock_item')->loadByProduct($_product)->getQtyIncrements() ?>
</option>
<?php } while ($i <= (int)Mage::getModel('cataloginventory/stock_item')->loadByProduct($_product)->getMaxSaleQty()) ?>
</select>
@lrkwz
lrkwz / app.module.js
Created June 18, 2016 23:33
Fontawesome iconify
angular
.module('myapp', [...])
.filter('iconify', ['$sce', function($sce){
return function(input, type){
var iconType = 'fa-file-o';
if( input ){
if( input.startsWith('image/')){
iconType = 'fa-file-pdf-o';
} else if (input == 'application/pdf') {
iconType = 'fa-file-image-o';
@lrkwz
lrkwz / app.js
Last active May 25, 2017 13:29 — forked from rnkoaa/app.js
A simple angularjs with angular-ui modal form which includes validation on the client side.Thanks http://scotch.io/tutorials/javascript/angularjs-form-validation
var app = angular.module("modalFormApp", ['ui.bootstrap']);
app.controller("modalAccountFormController", ['$scope', '$modal', '$log',
function ($scope, $modal, $log) {
$scope.showForm = function () {
$scope.message = "Show Form Button Clicked";
console.log($scope.message);
var modalInstance = $modal.open({
@lrkwz
lrkwz / wordpress_images_list.sh
Last active August 3, 2017 11:21
Estract a tar of images used by wordpress
#!/bin/bash
set -e
if [ "$1" != "" ]; then
FNAME=$(mktemp /tmp/foo.XXXXXXXXX)
cat <<EOSQL | mysql -u root -p $1 | sed -e s/\.[^\.]*$/\*/ | sed -e "s/^/ls /" > $FNAME
SELECT distinct files.meta_value AS ''
FROM
wp_posts posts
INNER JOIN wp_posts attachments ON posts.ID = attachments.post_parent
docker run --rm \
-it \
-v $(pwd):/input/ \
-u 0 \
pmsipilot/docker-compose-viz \
render -m image