Skip to content

Instantly share code, notes, and snippets.

@odie5533
odie5533 / gist:7282233
Last active December 27, 2015 06:29
GIMP Resize and Match DPI in Scheme Resize-match-dpi is a GIMP Script-Fu script written in Scheme to resize or scale an image along with scaling the DPI. Let’s consider an image being scanned which is 4.75″ x 4.70″. We scan the image at 300 DPI with a pixel resolution of 1425 x 1409 and we want to scale it down to 1280×1266. Using IrfanView, XNV…
; Released under the GNU GPL 3.0 or later
(define (resize-match-dpi image drawable newwidth newheight)
(let* (
(oldwidth (car (gimp-image-width image)))
(oldheight (car (gimp-image-height image)))
(newdpi 0)
)
(if (= newheight 0)
(set! newheight (round (* (/ oldheight oldwidth) newwidth)))
()
@odie5533
odie5533 / gist:7282209
Created November 2, 2013 18:55
When downloading a file from Perl, there’s many ways to go about it. You can use LWP, libcurl, wget, curl the program, etc. My shell hoster doesn’t include many perl binding so I can’t use LWP or libcurl. I use `curl -s $url` to download urls. The only problem with using any of the above mentioned methods is that they all block Irssi until the p…
use strict;
use Irssi;
use POSIX;
sub async_curl ($$$) {
my ($geturl, $callback, $argref) = @_;
my ($reader, $writer);
pipe($reader, $writer);
my $pid = fork();
if ($pid > 0) {
@odie5533
odie5533 / groovegrab.py
Created October 19, 2013 07:34
GrooveGrab - Automatically saves songs when listening in Grooveshark
"""
GrooveGrab - Automatically saves songs when listening in Grooveshark
Copyright (C) 2010 odie5533
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,