This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<modification> | |
<name>Images as URL for OpenCart 2.x</name> | |
<code>00000002</code> | |
<version>0.78</version> | |
<author>Arudmin</author> | |
<link>https://gist.github.com/arudmin/</link> | |
<file path="catalog/model/tool/image.php"> | |
<operation> | |
<search><![CDATA[if (!is_file(DIR_IMAGE . $filename)) {]]></search> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// catalog/model/tool/image.php | |
if (!is_file(DIR_IMAGE . $filename)) { | |
if (filter_var($filename, FILTER_VALIDATE_URL)) { | |
// generating dirname as first digit of productID (from filename) // PHP_EOL | |
preg_match_all('/_(\d{4,6})/m', basename($filename), $matches, PREG_SET_ORDER, 0); | |
$image_dir = $matches[0][1] ? $matches[0][1][0] : 'temp'; | |
$image_name = $matches[0][1] ? basename($filename) : substr(base64_encode($filename), 0, 7); | |
$image_path = 'catalog/' . $image_dir . '/' . $image_name; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function updateGradient() { | |
var a = colors[colorIndices[0]], | |
b = colors[colorIndices[1]], | |
c = colors[colorIndices[2]], | |
d = colors[colorIndices[3]], | |
e = 1 - step, | |
f = Math.round(e * a[0] + step * b[0]), | |
g = Math.round(e * a[1] + step * b[1]), | |
h = Math.round(e * a[2] + step * b[2]), | |
i = "#" + (f << 16 | g << 8 | h).toString(16), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
DIR="/var/spool/gammu/inbox/*" | |
if [[ $1 == "-r" ]]; | |
then | |
rm -rf $DIR | |
else | |
for f in $DIR | |
do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
### BEGIN INIT INFO | |
# Provides: syncthing | |
# Required-Start: $local_fs $remote_fs | |
# Required-Stop: $local_fs $remote_fs | |
# Should-Start: $network | |
# Should-Stop: $network | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Short-Description: Multi-user daemonized version of syncthing. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#install homebrew | |
ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)" | |
brew install coreutils wget npm nodejs iftop htop p7zip | |
# du -h -d 1 / | gsort -hr |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
# -*- coding: utf-8 -*- | |
import os | |
import re | |
from lxml import etree | |
import StringIO | |
import sys | |
reload(sys) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
ping -W 2 -c 1 8.8.8.8 > /dev/null | |
if [ $? -eq 0 ]; then | |
echo "online" | |
else | |
echo "offline" | |
logger -t [warn] “Internet connection lost. Trying to reload network interface” | |
sudo ifdown wlan0 | |
sleep 3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
echo "RASPBERRY PI UPDATING SCRIPT STARTED" | |
# Nginx Repo Add | |
sudo hostname -v pi | |
sudo localedef en_US.UTF-8 -i en_US -fUTF-8 | |
sudo echo 'deb http://nginx.org/packages/debian/ wheezy nginx | |
deb-src http://nginx.org/packages/debian/ wheezy nginx' >> /etc/apt/sources.list | |
wget http://nginx.org/keys/nginx_signing.key | |
sudo apt-key add nginx_signing.key && rm nginx_signing.key |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Require our module dependencies | |
var exec = require('child_process').exec; | |
// Create command array to invoke ImageMagick composite where | |
// -dissolve is the amount of transparency for the watermark | |
// -gravity tells how to align images of varying size | |
// -quality is the image quality of the JPEG (not required if producing PNG) | |
var command = [ | |
'composite', | |
'-dissolve', '50%', |