Ever wondered how many bytes of space are there left to transfer while doing a dd with a large image ?
Well, dd has a built-in trick in order to help you doing this.
Right from its man page, introducing now the magic :
Sending a USR1 signal to a running `dd’ process makes it print I/O statistics to standard error and then resume copying.
$ dd if=/dev/zero of=/dev/null& pid=$!
$ kill -USR1 $pid; sleep 1; kill $pid
18335302+0 records in 18335302+0 records out 9387674624 bytes (9.4 GB) copied, 34.6279 seconds, 271 MB/s
Pretty neat, huh ?
Posted by admin on March 26, 2010 at 9:16 pm under linux.
Comment on this post.
SELECT mail.id, mail.mail_name, domains.name, accounts.password, mail.postbox, mail.mbox_quota, mail.redirect, mail.redir_addr, mail_group, mail.autoresponder FROM mail, accounts, domains WHERE mail.account_id = accounts.id AND mail.dom_id = domains.id AND domains.name = ‘domain.tld’;
Posted by admin on March 19, 2010 at 10:21 am under email, mysql, plesk.
Comment on this post.
Ever want to immediatly serve content from a specific directory over HTTP, but didn’t want to bother messing with
httpd.conf or other webserver configiurations?
If you’ve got Python installed, this is a snap. Execute python with the SimpleHTTPServer module, using port 8080 so
there isn’t a need to elevate privs to root.
python -m SimpleHTTPServer 8080
Serving HTTP on 0.0.0.0 port 8080 …
or python3 -m http.server 8080
Sure enough, pointing a browser to the IP address :8080 of the box hits my home directory listing. Super easy, super
fast, super simple!
I use this to serve content to my PS3. The PS3 doesn’t support NFS or CIFS, so to download content to the hard drive,
the best method is by pulling it over HTTP with the embedded web brower. On my MacBook, I change into the directory
containing whatever media I want to transfer, fire up HTTP, and suck it down to the hard drive on the PS3. Nice!
source: http://prefetch.net/blog/index.php/2009/10/31/serve-out-content-over-http-from-your-cwd-immediatly/
Posted by admin on February 23, 2010 at 5:53 pm under bash, linux.
Comment on this post.
C:\Program Files\PS3 Media Server\win32>mencoder d:\77\DSC_0215.AVI -ovc x264 -x
264encopts bitrate=3200 -oac mp3lame -o d:\77\plc.mkv
Posted by admin on February 22, 2010 at 1:14 am under linux, multimedia, windows.
Comment on this post.
You may check first what is the path of sendmail:
whereis sendmail
or php -i | grep sendmail
move /usr/sbin/sendmail
to something like /usr/sbin/sendmail.or
vi /usr/sbin/sendmail
put the code below:
#!/usr/bin/perl
# use strict;
use Env;
my $date = `date`;
chomp $date;
open (INFO, ">>/var/log/formmail.log") || die "Failed to open file ::$!";
my $uid = $>;
my @info = getpwuid($uid);
if($REMOTE_ADDR) {
print INFO "$date - $REMOTE_ADDR ran $SCRIPT_NAME at $SERVER_NAME \n";
}
else {
print INFO "$date - $PWD - @info\n";
}
my $mailprog = '/usr/sbin/sendmail.or';
foreach (@ARGV) {
$arg="$arg" . " $_";
}
open (MAIL,"|$mailprog $arg") || die "cannot open $mailprog: $!\n";
while (<STDIN> ) {
print MAIL;
}
close (INFO);
close (MAIL);
chmod a+x /usr/sbin/sendmail
touch /var/log/formmail.log
and chmod 777 /var/log/formmail.log
that should be all.
Posted by admin on February 19, 2010 at 2:34 pm under bash scripting, email, linux, php, security.
Comment on this post.
Full list of available commands Ctrl-a Ctrl-?
Open a new screen in existing session Ctrl-a Ctrl-c
Switch to last accessed screen Ctrl-a Ctrl-a
Switch to next screen Ctrl-a Ctrl-n
Switch to previous screens Ctrl-a Ctrl-p
Disconnect, leaving the session running in background Ctrl-a Ctrl-d
Split screen vertically Ctrl-a Ctrl-S
Unsplit screen Ctrl-a Ctrl-Q
Move focus between splits Ctrl-a Ctrl-Tab
List currently opened screens Ctrl-a Ctrl-S
Rename current screen Ctrl-a Ctrl-A
Monitor a screen for silence Ctrl-a Ctrl-_
To disconnect (but leave the session running)
Hit Ctrl + A and then Ctrl + D in immediate succession. You will see the message [detached]
To reconnect to an already running session
screen -r
To reconnect to an existing session, or create a new one if none exists
screen -D -r
To create a new window inside of a running screen session
Hit Ctrl + A and then C in immediate succession. You will see a new prompt.
To switch from one screen window to another
Hit Ctrl + A and then Ctrl + A in immediate succession.
To list open screen windows
Hit Ctrl + A and then W in immediate succession
Posted by admin on February 16, 2010 at 12:39 am under bash, linux.
Comment on this post.
wget --user-agent Firefox --save-headers --referer "http://www.google.com/search?q=duuude" "example.com"
Posted by admin on February 9, 2010 at 12:33 pm under apache, dns, security.
Comment on this post.
<?php
$password = crypt(‘mypassword’ , ‘d4’);
print $password . ” is the CRYPT_STD_DES version of mypassword<br>”;
$password = crypt(‘mypassword’ , ‘k783d.y1g’);
print $password . ” is the CRYPT_EXT_DES version of mypassword<br>”;
$password = crypt(‘mypassword’ , ‘$1$d4juhy6d$’);
print $password . ” is the CRYPT_MD5 version of mypassword<br>”;
$password = crypt(‘mypassword’ , ‘$2a$07$kiuhgfslerd………..$’);
print $password . ” is the CRYPT_BLOWFISH version of mypassword<br>”;
?>
This will output something like this:
d4/qPbCcJ5tD. is the CRYPT_STD_DES version of mypassword
k7xEagYCDPPSc is the CRYPT_EXT_DES version of mypassword
$1$d4juhy6d$a.jIPYnvne1FWF2V6mGQR0 is the CRYPT_MD5 version of mypassword
$2a$07$kiuhgfslerd………..6k0kSI76CqJ/RWGnSp9MWRDF91gJZfW is the CRYPT_BLOWFISH version of mypassword
Posted by admin on February 3, 2010 at 11:24 pm under php.
Comment on this post.
<?
$data = array(0, 1, 2, 'three', 4, 5, 'six', 7, 8, 'nine', 10);
$mod1 = preg_grep("/4|5|6/", $data);
$mod2 = preg_grep("/[0-9]/", $data, PREG_GREP_INVERT);
print_r($mod1);
echo "<br>";
print_r($mod2);
?>
http://php.about.com/od/advancedphp/ss/php_preg.htm
Posted by admin on February 3, 2010 at 11:15 pm under php.
Comment on this post.
The way to execute PHP on a .html page is to modify your .htaccess file. This file may be hidden, so depending upon your FTP program you may have to modify some settings to see it. Then you just need to add this line for .html:
AddType application/x-httpd-php .html
Or for .htm
AddType application/x-httpd-php .htm
If you only plan on including the PHP on one page, it is better to setup this way:
AddType application/x-httpd-php .html
This code will only make the PHP executable on the yourpage.html file, and not on all of your html pages.
Posted by admin on February 3, 2010 at 11:13 pm under apache, php.
Comment on this post.