Skip to content

Instantly share code, notes, and snippets.

View ddmitov's full-sized avatar

Dimitar D. Mitov ddmitov

View GitHub Profile
@ddmitov
ddmitov / jpg-resizer.pl
Created March 20, 2016 08:22
Simple resizer for multiple JPG images based on the 'convert' binary from ImageMagick. Full path to a directory containing JPG files is the first and only command line argument needed. Original files are not overwritten! Resized images are saved in a subfolder.
#!/usr/bin/perl -w
use strict;
use warnings;
my $FOLDER_TO_OPEN = $ARGV[0];
opendir (my $directory_handle, $FOLDER_TO_OPEN) or die $!;
my $output_directory_name = "converted-images";
@ddmitov
ddmitov / sqlite-triggers.sql
Last active August 12, 2024 08:35
Example SQLite triggers
CREATE TRIGGER calculate_vat_insert AFTER INSERT ON inventory
BEGIN
UPDATE inventory SET PRICE_VAT = new.PRICE/100*20+new.PRICE WHERE id = new.id;
END;
CREATE TRIGGER calculate_vat_update UPDATE OF PRICE ON inventory
BEGIN
UPDATE inventory SET PRICE_VAT = new.PRICE/100*20+new.PRICE WHERE id = old.id;
END;
@ddmitov
ddmitov / opera-session-converter.sh
Last active June 25, 2017 20:21
Opera Session Converter, v.0.1 will convert all your Opera session files in the current folder to plain text files with URLs only."
#!/usr/bin/env bash
# Welcome message:
echo " "
echo "Opera Session Converter, v.0.1."
echo "Will convert all your Opera session files in the current folder to"
echo "plain text files with URLs only."
echo "Old files will be preserved and new files with"
echo "a .win.txt extension will be created."
echo "Input files must be without spaces!"