Skip to content

Instantly share code, notes, and snippets.

View hrpunio's full-sized avatar

tomasz przechlewski hrpunio

View GitHub Profile
#!/bin/bash
MY_PIC="$1" ## filename of the picture to upload ##
ALBUM_ID=6008849823888405298 # ID of picasaweb album
PIC_TITLE=`basename $MY_PIC` # filename w/o extension
PIC_TYPE=`file -b --mime-type "$MY_PIC"`
ACCESS_TOKEN=$(oauth2picasa.py) ## Acces token is managed with Python's script now
## Note that ALBUM_XML URL starts now from https:// now
ALBUM_XML="https://picasaweb.google.com/data/feed/api/user/$USER_ID/albumid/$ALBUM_ID"
@hrpunio
hrpunio / oauth2picasa.py
Created June 22, 2015 09:59
OAuth 2.0 authorization borrowed from https://github.com/leocrawford/picasawebsync
#!/usr/bin/python
import os
import time
import httplib2
## https://github.com/google/oauth2client
## installed with pip install --upgrade oauth2client (or some other way)
from oauth2client import client
def oauthLogin():
@hrpunio
hrpunio / blogger_upload.pl
Created July 8, 2015 15:25
Upload post to blogger with Perl/Python (OAuth 2.0 authorozation)
#!/usr/bin/perl
# *** Wyslanie posta na blogger.com ***
use strict;
use LWP::UserAgent;
use XML::LibXML;
use Getopt::Long;
my $profileID="default";
my $blogID = '1928418645181504144'; # Identyfikator bloga
my $blog_entry ;
@hrpunio
hrpunio / picasaweb.pl
Created July 12, 2015 16:35
Upload file, create album and list albums @ picasaweb via API
#!/usr/bin/perl
# *** Upload file | Create album | List albums @ picasaweb via API ***
use strict;
use LWP::UserAgent;
use Getopt::Long;
use File::MimeInfo;
use XML::LibXML;
use open ':std', ':encoding(UTF-8)';
my $profileID="default";
@hrpunio
hrpunio / picassa_album_create.sh
Created July 18, 2015 14:11
Create album @ picasaweb
#!/bin/bash
ALBUM_TITLE="$1" # Album title
ALBUM_DESCR="$2" # Album description
Album_Keywords="$3" # Album keywords (comma separated)
ACCESS_TOKEN=$(oauth2picasa.py) ## Acces token is managed with Python's script now
MESSAGE="<entry xmlns='http://www.w3.org/2005/Atom'
xmlns:media='http://search.yahoo.com/mrss/'
xmlns:gphoto='http://schemas.google.com/photos/2007'>
@hrpunio
hrpunio / picasaweb2.pl
Last active August 29, 2015 14:25
Upload file | Upload file with metadata | Create album | List albums @ picasaweb via API
#!/usr/bin/perl
#
# *** Upload file | Upload file with metadata | Create album | List albums @ picasaweb via API ***
#
# Examples of usage
# Note: if option --printonly is present NO real action is performed
# ONLY http message is verbatim printed on STDOUT (useful in case of problems)
# -----------------
# Upload with metadata:
# picasaweb.pl -xload -title Komorowski -descr 'Komorowski w czapce' -keywords 'komorowski,prezydent' -file BK_w_czapce.jpg -album 12345
#!/usr/bin/perl
# HTML to Blogger conversion script.
#
# Usage: blogspot-import.pl file1 file2 file3... > import-file.xml
#
# The resulting file import-file.xml is Atom [ http://tools.ietf.org/html/rfc4287 ]
# compatible and thus ready to be imported with
# Blogger import facility.
#
# It is assumed the following structure of each HTML file:
%% Rysowanie diagramow sciezkowych w programie MetaPost
%% *** (c) T.Przechlewski 2009 ***
%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%
%% zmienna mierzalna:
ux := 1mm ; %% jednostka
%%
rwd:=5ux; %% szerokosc prostokata
rht:=3ux; %% wysokosc prostokata
err:=4ux; %% dlugosc strzalki oznaczajacej blad
# Corrupt countries were more likely to support the OOXML document format
# Kirjoittaja: Kai Puolamäki, Syyskuu 5, 2007 - 08:22.
# http://www.effi.org/blog/kai-2007-09-05.en.html
#
# Read in the data table:
B <- read.csv("http://www.effi.org/system/files?file=ooballot_0.txt")
# CPI indices of the countries that voted for approval:
capp <- B[!is.na(B[,"CPI"]) & (B[,"Vote"]=="Approval" |
#!/usr/bin/perl
# Generuje plik .fd dla maksymalnie o¶miu odmian kroju
# Por.
use Getopt::Long;
my $debug = 0;
GetOptions(