Montag, 29. Juni 2009

LINUX: create cdrom iso

to copy a cd to an iso image:

dd if=/dev/sr0 of=image.iso bs=2048

or use brasero application

Freitag, 12. Juni 2009

PERL: get page with perl

a example



sub getpage($$) {
my $link = shift;
my $base = shift;

my @site_content;

my $ua = LWP::UserAgent->new();
$ua->agent('Mozilla/5.0');

my $request = HTTP::Request->new('GET', $link);
my $response = $ua->request($request);
print "Retrieving http-page...\n";
if ( $response->is_error() ) {
$urls{$base}{'error'} = "Error code : ". $response->code() . "\n" .
"Error message: " . $response->message() . "\n";
return ();
}
else {
#print Dumper($response);
@site_content = split /\n/, $response->content();
$urls{$base}{'lasturl'} = $response->request->uri;
return @site_content;
}
}

Freitag, 5. Juni 2009

encrypt with gpg

encrpyt:

gpg -c --cipher-algo blowfish filename.txt


decrypt:

gpg -d filename.txt.gpg > output.txt

Donnerstag, 2. April 2009

format output in ruby

with #{ }

puts "Text is #{["Test 1", "Test 2"][1]}"
=>Text is Test 2

["Test 1", "Test 2"]
create array with "Test 1" and "Test 2"

["Test 1", "Test 2"][1]
choose second item [1]

print out as variable with #{}

simple outputs through strings objects


see info: ri String#%

format%argument => string

"%05d" % 123       fill with zero on numbers
=> "00123"

"%05s" % 123 do space
=> " 123"

"%-05s" % 123
=> "123 "

"%-5s: %08x" % [ "ID", self.object_id ]
=> "ID : fdbe224ac"
"%10.3f" % 123
=> " 123.000"

"%-10.3f" % 123
=> "123.000 "



output with sprintf analog to sprintf in c

see info: ri sprintf

format(format_string [, arguments...] ) => string
sprintf(format_string [, arguments...] ) => string

sprintf("%d %04x", 123, 123)
=> "123 007b"
sprintf("%08b '%4s'", 123, 123)
=> "01111011 ' 123'"
sprintf("%1$*2$s %2$d %1$s", "hello", 8)
=> " hello 8 hello"
sprintf("%1$*2$s %2$d", "hello", -8)
=> "hello -8"
sprintf("%+g:% g:%-g", 1.23, 1.23, 1.23)
=> "+1.23: 1.23:1.23"
sprintf("%u", -123)
=> "..4294967173"

i,d integer
x hex
s string
b bit
e,f,g floating
%x$y x which argument, y what (i,d,s,..)
%1$*2$s argument 1 with length of argument 2 (string)

Montag, 23. Februar 2009

ruby infos

http://www.rubyinside.com/passenger-stack-quickly-install-a-full-ruby-and-passenger-stack-1533.html

Passenger-Stack is a set of scripts for the provisioning tool Sprinkle that make installing a full Ruby, Apache and Passenger-based stack almost a one-line task. It'll take almost any UNIX-y (correction: Ubuntu / Debian) server of your choice from a generic install through to deploying Rack-based apps (including those built with Rails, Merb, Sinatra, and Ramaze).


=>
Sprockets: A Ruby-powered JavaScript dependency library from 37signals

Building a Ruby Gem (From Scratch) Using Behavior Driven Development

Montag, 26. Januar 2009

SECURITY macchanger

http://www.fedorawiki.de/index.php/MACChanger

Montag, 19. Januar 2009

COMP cdrecord

cdrecord -scannbusscsibus1:
1,0,0 100) 'HL-DT-ST' 'DVD+-RW GSA-H31L' 'W616' Removable CD-ROM
1,1,0 101) *


cdrecord -v -pad dev=1,0,0 speed=8 blub.iso