Skip to content

Instantly share code, notes, and snippets.

View vitaly-zdanevich's full-sized avatar

Vitaly Zdanevich vitaly-zdanevich

View GitHub Profile
for f in * .*; do
[ -f "$f" ] && \
printf "%s %s %s\n" "$f" $(du -h -- "$f" | cut -f1) $(md5sum -- "$f" | cut -d' ' -f1)
done
@vitaly-zdanevich
vitaly-zdanevich / change-speed-of-slideshow-on-main-from-3-seconds-to-6.ocmod.xml
Created November 27, 2015 13:24
opencart2 ocmod: Change speed of slideshow on main from 3 seconds to 6
<modification>
    <name>Change speed of slideshow on main from 3 seconds to 6</name>
    <version>1</version>
    <link>http://about.me/zdanevich</link>
    <author>Vitaly Zdanevich</author>
    <code>change-speed-of-slideshow-on-main-from-3-seconds-to-6</code>
    <file path="catalog/view/theme/default/template/module/slideshow.tpl">
        <operation>
@vitaly-zdanevich
vitaly-zdanevich / script.js
Last active December 15, 2015 21:19
VK: market: set price for all visible (loaded at current page) products in category
var price = 190000;
var sleepTime = 3000; // ms
var itemsAll = document.querySelectorAll('.market_row_inner_cont');
var items = [];
var i = 0;
for (var j = 0; j < itemsAll.length; j++) {
var priceOrig = itemsAll[j].querySelector('.market_row_price').innerHTML.replace(/,/g, '').replace(' rub.', '');
if (priceOrig != price) {
items.push(itemsAll[j].querySelector('.market_row_inner_cont a'));
@vitaly-zdanevich
vitaly-zdanevich / tx.sh
Last active March 9, 2016 08:00
call this every hour - and will do some action if for hour uploaded less than 4 gb. I wrote this script for restarting git-lfs push that stopped uploading after a few hours
#!/bin/bash
# running by cron every hour; get currently uploaded value and compare with uploaded value hour ago (readed from file),
# if delta is less then 4 gb - make something
# at the end - write currentry uploaded value to the file
prev=$(cat "./TX.txt")
now=$(ip -s link ls eth1 | awk 'NR==6{print $1}')
delta=$((now - prev))
delta=$((delta / 1000 / 1000 / 1000))
echo "$(date): delta (uploaded for last hour): $delta"
@vitaly-zdanevich
vitaly-zdanevich / starwars.sh
Created February 21, 2016 20:21
code for beep program that generate sound: StarWars
beep -l 350 -f 392 -D 100 -n -l 350 -f 392 -D 100 -n -l 350 -f 392 \
-D 100 -n -l 250 -f 311.1 -D 100 -n -l 25 -f 466.2 -D 100 -n \
-l 350 -f 392 -D 100 -n -l 250 -f 311.1 -D 100 -n -l 25 -f 466.2 \
-D 100 -n -l 700 -f 392 -D 100 -n -l 350 -f 587.32 -D 100 -n \
-l 350 -f 587.32 -D 100 -n -l 350 -f 587.32 -D 100 -n -l 250 \
-f 622.26 -D 100 -n -l 25 -f 466.2 -D 100 -n -l 350 -f 369.99 \
-D 100 -n -l 250 -f 311.1 -D 100 -n -l 25 -f 466.2 -D 100 -n \
-l 700 -f 392 -D 100 -n -l 350 -f 784 -D 100 -n -l 250 -f 392 \
-D 100 -n -l 25 -f 392 -D 100 -n -l 350 -f 784 -D 100 -n \
-l 250 -f 739.98 -D 100 -n -l 25 -f 698.46 -D 100 -n \
beep -n -f 146 -l 20 -D 0 -n -f 369 -l 20 -D 0 -n -f 659 -l 20 -D 47 -n -f 146 -l 20 -D 0 -n -f 369 -l 20 -D 0 -n -f 659 -l 20 -D 189 -n -f 146 -l 20 -D 0 -n -f 369 -l 20 -D 0 -n -f 659 -l 20 -D 190 -n -f 146 -l 20 -D 0 -n -f 369 -l 20 -D 0 -n -f 523 -l 20 -D 47 -n -f 146 -l 20 -D 0 -n -f 369 -l 20 -D 0 -n -f 659 -l 20 -D 190 -n -f 391 -l 20 -D 0 -n -f 493 -l 20 -D 0 -n -f 783 -l 20 -D 475 -n -f 195 -l 20 -D 0 -n -f 391 -l 20 -n -f 195 -l 20 -D 0 -n -f 391 -l 20 -D 473 -n -f 195 -l 20 -D 0 -n -f 329 -l 20 -D 0 -n -f 523 -l 20 -D 332 -n -f 164 -l 20 -D 0 -n -f 261 -l 20 -D 0 -n -f 391 -l 20 -D 332 -n -f 130 -l 20 -D 0 -n -f 195 -l 20 -D 0 -n -f 329 -l 20 -D 332 -n -f 174 -l 20 -D 0 -n -f 261 -l 20 -D 0 -n -f 440 -l 20 -D 189 -n -f 195 -l 20 -D 0 -n -f 293 -l 20 -D 0 -n -f 493 -l 20 -D 189 -n -f 184 -l 20 -D 0 -n -f 277 -l 20 -D 0 -n -f 466 -l 20 -D 47 -n -f 174 -l 20 -D 0 -n -f 261 -l 20 -D 0 -n -f 440 -l 20 -D 190 -n -f 164 -l 20 -D 0 -n -f 261 -l 20 -D 0 -n -f 391 -l 20 -D 95 -n -f 261 -l 20 -D 0 -n -f 391 -
for n in 1 2 3 4 5 6 7 8 9 0; do
for f in 400 500 600 700 800 900 1000 1100 1200 1300 1400 1500 1600; do
beep -f $f -l 20
done
done
@vitaly-zdanevich
vitaly-zdanevich / test.php
Created May 6, 2016 17:38
temp code example: sending email about order
<?php
class ControllerModuleCheckout extends Controller {
public function checkout() {
$products = json_decode(html_entity_decode($_POST['products'])); //create object from json string
$message = '<html><head></head><body><table>';
$priceTotalBYR = 0;
foreach($products as $product) :
$message .= '<tr>';
$product_id = $product->product_id;
$product_quantity = $product->quantity;
@vitaly-zdanevich
vitaly-zdanevich / checkout.js
Created May 6, 2016 17:44
test code: checkout
function checkout(e) {
var subject = '';
if($('.pav-shop-cart').length > 0){ //if on checkout page
var city = $('#checkout-cart #city').val();
var name = $('#checkout-cart [name=name]').val();
var phone = $('#checkout-cart [type=tel]').val();
var email = $('#checkout-cart [type=email]').val();
var address = $('#checkout-cart #address').val();
var comment = $('#checkout-cart textarea').val();
subject = 'Заказ со страницы корзины';