Skip to content

Instantly share code, notes, and snippets.

Avatar

Luca Orlandi lrkwz

View GitHub Profile
View docker-compose-2-image.sh
docker run --rm \
-it \
-v $(pwd):/input/ \
-u 0 \
pmsipilot/docker-compose-viz \
render -m image
@lrkwz
lrkwz / wordpress_images_list.sh
Last active Aug 3, 2017
Estract a tar of images used by wordpress
View wordpress_images_list.sh
#!/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
@lrkwz
lrkwz / app.js
Last active May 25, 2017 — 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
View app.js
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 / app.module.js
Created Jun 18, 2016
Fontawesome iconify
View app.module.js
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 / addtocart.phtml
Last active Jan 26, 2016
Magento quantity dropdown
View addtocart.phtml
<?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 / projadd.bash
Created Mar 28, 2012
Create a new svn repository
View projadd.bash
#!/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 / whatismyip.sh
Created Mar 8, 2012
Your real ip as seen from outside world
View whatismyip.sh
#!/bin/bash
wget http://automation.whatismyip.com/n09230945.asp -O - -o /dev/nul
@lrkwz
lrkwz / liferay_backup.sh
Created Sep 15, 2011
Safe backup liferay.
View liferay_backup.sh
#!/bin/bash
DBUSR=****
DBPWD=****
# You should be root
if [ "$(whoami)" != "root" ]; then
echo "Sorry, you are not root."
exit 1
fi
You can’t perform that action at this time.