rex's blog

search for files and create an archive with them (tar,find,linux)

create a tar file with all your mp3 files

tar cvf mp3.tar `find / -name *.mp3`

how to create 64 bit int, unsigned long long variable with c++



#include <stdio.h>
#include <inttypes.h>


int main(){


  uint64_t x = -10033333000;
  int64_t y =  113333334445533;

  // print x as unsigned variable PRIu64
  printf("value of x is: %" PRIu64 ,x);
  printf("\n");
  // print x as integer variable PRIi64
  printf("value of y is: %" PRIi64,y);
  printf("\n");


  // this is the same like y
  unsigned long long z = -212121212121;
  printf("value of z is: %llu",z,"\n");
  printf("\n");


  return 0;
}

gcc  int64bit.c -o int64bit
int64bit.c: In function ‘main’:

Howto duplicate (clone) VirtualBox image in Windows 7

1. klick on windows icon and write 'cmd' and press ENTER to open a terminal in windows.

2. change to VirtualBox directory
cd C:\Program Files\Sun\VirtualBox

3. run VBoxManage.exe


C:\Program Files\Sun\VirtualBox>VBoxManage.exe clonehd "D:\vm\WinXP.vdi" "D:\vm\WinXp-clone.vdi"

Sun VirtualBox Command Line Management Interface Version 3.1.8
(C) 2005-2010 Sun Microsystems, Inc.
All rights reserved.

0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
Clone hard disk created in format 'VDI'. UUID: 609c2e84-981c-4e73-b32b-dd7fbc5ee
4c7

Howto log slow MySQL Queries in Debian

Sometimes MySQL use a lot of CPU and its really slow.
If you want to log the queries just comment out following lines in '/etc/mysql/my.cnf'

# Here you can see queries with especially long duration
log_slow_queries = /var/log/mysql/mysql-slow.log
long_query_time = 10

If a query need more then 10 seconds to get executed mysql will log it in '/var/log/mysql/mysql-slow.log'

[Howto Fix] Table './eximstats/sends' is marked as crashed and should be repaired

I've tryed to dump my whole databases with mysqldump


mysqldump --all-databases > all_databases.sql

got the error 'Table './eximstats/sends' is marked as crashed and should be repaired when using LOCK TABLES'

'eximstats' is my databasename und 'sends' my tablename.

I've tryed to repair the table with


mysqlcheck -u root --check auto-repair --optimize all-databases

but it no not worked

I've also tryed to repair ith with


mysql> repair table eximstats.sends;

Server Crash - "isc_socket_create: fcntl/reserved: Too many open files" [Howto Fix]

A Debian has been crashed and I should found how it happened.

Memory, Swap and Harddisk wasn't full, but the Server was unreachable, no ssh, ftp, http, ping...

After a hardware reset I have analysed the log files.

The crash was 22:45 offline and I want to analyse log entries between 22:40 and 22:50 and greped them


cat syslog.2 |grep '22:4'
...
Apr 2 22:41:12 USER named[3493]: isc_socket_create: fcntl/reserved: Too many open files
Apr 2 22:41:12 USER named[3493]: isc_socket_create: fcntl/reserved: Too many open files

Howto install Volatility (RAM / Memory Forensic Framework) in Windows

1. Download Python

http://www.python.org/download/

I have installed Python 2.6.4 in Windows 7, 64 Bit Edition.

Open a windows shell and add Python to your Windows path with

PATH=%PATH%;C:\Python26

If you installed Python somewhere else change 'C:\Python26' with your path.

2. Download Volatility Framework

https://www.volatilesystems.com/volatility/1.3/Volatility-1.3_Beta.zip

and extract it to d:\Forensic\Tools\Volatility

3. Test Volatility


d:\Forensic\tools\Volatility>python volatility pslist -f d:\Forensic data\ramdump2.dd

How to mount shared Folder in VirtualBox and Ubuntu Linux

1. Install Guest Additions
Open VirtualBox and Start your Virtual Machine.
Click to"Devices" and "Install guest additions"
VirtualBox will a mount a CD with guest additions on your Desktop.

cd /media/cdrom

if you have 32-Bit Linux use
sudo ./VBoxLinuxAdditions-x86.run

if you have 64-Bit Linux use
sudo ./VBoxLinuxAdditions-amd64.run
After you successful installed guest additions reboot your virtual machine.

2. Create Shared Folder
Click to "Devices" and "Shared Folder" on your virtual machine window.

Useful freeware Tools for Windows

Firefox - great Browser with alot of addons
http://www.mozilla.com/

Notepad++ - Editor with Syntax highlighting in multiple languages

CutePDF - convert any document or website to pdf
Daemen Tools - Create Virtual CD / DVD Disks
putty
adware
antivir
icq
msn messenger
acrobat reader
flash player
java virtual machine
vmware server
virtualbox
filezilla
openoffice
utorrent
cdburnerxp
picasa
winamp
google earth

Packet Sniffing and Monitoring with Tshark / Wireshark

capture the traffic for 300 seconds and save it in output_file and exit

tshark -a duration:300 -q -w output_file

Sniff the traffic and show it on the screen
tshark -S

Sniff 1000 packets and show it on the screen
tshark -S -c 1000

IO Stats - How many packets and frames has been transfered in 60 seconds?
tshark -a duration:60 -z io,stat,60

read the dumpfile 'output_file'
tshark -r output_file

read output_file and show only http connections from the ip 1.2.3.4

Syndicate content

CafeWebmaster.com(CW) is a free online community for webdevelopers and beginners. Anybody can share their code, articles, tips, tutorials, code-examples or other webdesign related material on the site. Newbies can submit their questions and reply to existing questions. CW does not guarantee or warrant reliability of code, data and information published on the site. Use the site on your own risk. The site takes no responsibility of direct or indirect loss or any kind of harm to its users. The site also doesn't take responsibility of infected files or source code with any kind of infection or viruses, worms, spywares, malwares, trojan horses. CW reserves the right to edit, move, or delete any of content for any reason.