Skip to content

Instantly share code, notes, and snippets.

@mokanfar
Last active August 10, 2019 02:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mokanfar/acfd45aa9819432a6e2fcea566513d17 to your computer and use it in GitHub Desktop.
Save mokanfar/acfd45aa9819432a6e2fcea566513d17 to your computer and use it in GitHub Desktop.
/z/bin
#!/bin/env bash
#requirements wget
if [ -z "$1" ] && [ -z "$2" ]; then
echo "No url provided. exiting...";
elif [[ -z "$2" ]]; then
wget -r -l1 -H -t1 -nd -N -np -A jpg,jpeg,png,webm,gif -erobots=off $1;
rm *s.*
else
mkdir $2;
cd $2;
wget -r -l1 -H -t1 -nd -N -np -A jpg,jpeg,png,webm,gif -erobots=off $1;
rm *s.*
fi
#!/usr/bin/env bash
if [ -f $PWD/temp.db ]; then
rm $PWD/temp.db
fi
if [ -f $PWD/matched.csv ]; then
rm $PWD/matched.csv
fi
ARRAY=($(ls $PWD))
file1=$(echo ${ARRAY[0]} | awk '{split($0,a,"."); print a[1]}')
file2=$(echo ${ARRAY[1]} | awk '{split($0,a,"."); print a[1]}')
fieldname1=${1:-match}
fieldname2=${1:-match}
csvsql --db sqlite:///temp.db --insert ${ARRAY[0]} ${ARRAY[1]}
#merge ish
sql2csv --db sqlite:///temp.db --query "SELECT ${file1}.*, ${file2}.* FROM ${file1} LEFT JOIN ${file2} ON ${file1}.${fieldname1} = ${file2}.${fieldname2};" > $PWD/matched.csv
csvlook $PWD/matched.csv | less -S
exit 0
#!/usr/bin/env php
<?php
if (isset($argv[1])) {
$asdf2 = $argv[1];
$asdf = explode("https:", $asdf2);
$asdf = array_slice($asdf,1);
}
else {
die('no specified');
}
$snippet = <<<'END'
<div class="item active">
<a href="{{store url=""}}specials/new-arrivals.html">
<picture>
END;
$snippet .="\n\t\t" . '<source srcset="'. $asdf[0] .'" media="(min-width: 1500px)">';
$snippet .="\n\t\t" . '<source srcset="'. $asdf[1] .'" media="(min-width: 1200px)">';
$snippet .="\n\t\t" . '<source srcset="'. $asdf[2] .'" media="(min-width: 960px)">';
$snippet .="\n\t\t" . '<source srcset="'. $asdf[3] .'" media="(min-width: 640px)">';
$snippet .="\n\t\t" . '<source srcset="'. $asdf[4] .'" media="(min-width: 480px)">';
$snippet .="\n\t\t" . '<source srcset="'. $asdf[5] .'" media="(min-width: 320px)">';
$snippet .="\n\t\t" . '<img class="img-responsive" srcset="'. $asdf[5] .'" alt="Current Furniture Sale">' . "\n";
$snippet .= <<<'END'
</picture></a>
</div>
END;
echo $snippet;
exit;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment