Skip to content

Instantly share code, notes, and snippets.

View vitaly-zdanevich's full-sized avatar

Vitaly Zdanevich vitaly-zdanevich

View GitHub Profile
@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 \
@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 / 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 / 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>
for f in * .*; do
[ -f "$f" ] && \
printf "%s %s %s\n" "$f" $(du -h -- "$f" | cut -f1) $(md5sum -- "$f" | cut -d' ' -f1)
done