summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@server-speed.net>2011-05-15 14:02:38 +0200
committerFlorian Pritz <bluewind@server-speed.net>2011-05-15 14:02:38 +0200
commit2a85f5f9ca4fe5b758b489f02f9ec0d0aff55587 (patch)
tree34274a0e70db49a0a51cb37d08e19d969ee8831c
parentfcb85132b3bb40f054cb775cbffe0e412f064ce6 (diff)
downloadbin-2a85f5f9ca4fe5b758b489f02f9ec0d0aff55587.tar.gz
bin-2a85f5f9ca4fe5b758b489f02f9ec0d0aff55587.tar.xz
add new scripts
Signed-off-by: Florian Pritz <bluewind@server-speed.net>
-rwxr-xr-xdropbox_gallery_dl.pl20
-rwxr-xr-xround-corners.sh10
-rwxr-xr-xurldecode16
3 files changed, 46 insertions, 0 deletions
diff --git a/dropbox_gallery_dl.pl b/dropbox_gallery_dl.pl
new file mode 100755
index 0000000..8b22af8
--- /dev/null
+++ b/dropbox_gallery_dl.pl
@@ -0,0 +1,20 @@
+#!/usr/bin/perl
+use warnings;
+use strict;
+use Data::Dumper;
+use WWW::Mechanize;
+use LWP::Simple;
+
+my $url = $ARGV[0];
+
+my $mech = WWW::Mechanize->new();
+
+$mech->get($url);
+
+my $content = $mech->content();
+while ($content =~ m/^\s*'filename': '(.*)',$/mg) {
+ my $img_name = $1;
+ $content =~ m/^\s*'original': "(.*)"$/mg;
+ my $img_url = $1;
+ getstore($img_url, $img_name);
+}
diff --git a/round-corners.sh b/round-corners.sh
new file mode 100755
index 0000000..62b984d
--- /dev/null
+++ b/round-corners.sh
@@ -0,0 +1,10 @@
+#!/bin/zsh
+
+for i in "$@"; do
+convert $i \
+ \( +clone -alpha extract \
+ -draw 'fill black polygon 0,0 0,8 8,0 fill white circle 8,8 8,0' \
+ \( +clone -flip \) -compose Multiply -composite \
+ \( +clone -flop \) -compose Multiply -composite \
+ \) -alpha off -compose CopyOpacity -composite rounded_$i.png
+done
diff --git a/urldecode b/urldecode
new file mode 100755
index 0000000..19df702
--- /dev/null
+++ b/urldecode
@@ -0,0 +1,16 @@
+#!/bin/bash
+arg="$1"
+i="0"
+while [ "$i" -lt ${#arg} ]; do
+ c0=${arg:$i:1}
+ if [ "x$c0" = "x%" ]; then
+ c1=${arg:$((i+1)):1}
+ c2=${arg:$((i+2)):1}
+ printf "\x$c1$c2"
+ i=$((i+3))
+ else
+ echo -n "$c0"
+ i=$((i+1))
+ fi
+done
+