Rabu, 6 Januari 2016

convert JPG to PDF

Just use this:
convert *.jpg output.pdf and/or convert *.jpg -adjoin output.pdf
convert books.png books.jpeg combined.pdf
convert "*.{png,jpeg}" outfile.pdf
In general case you can combine more files into one pdf file with including them inside {} and separate them with a single comma.
convert "*.{ext1,ext2,ext3,...}" outfile.pdf

More info:
  1. http://unix.stackexchange.com/questions/29869/converting-multiple-image-files-from-jpeg-to-pdf-format
  2. http://catlingmindswipe.blogspot.my/2013/11/how-to-convert-jpg-to-pdf-using.html

tcpdump

Basic Usage
So, based on the kind of traffic I’m looking for, I use a different combination of options to tcpdump, as can be seen below:
Basic communication // see the basics without many options
# tcpdump -nS
Basic communication (very verbose) // see a good amount of traffic, with verbosity and no name help
# tcpdump -nnvvS
A deeper look at the traffic // adds -X for payload but doesn’t grab any more of the packet
# tcpdump -nnvvXS
Heavy packet viewing // the final “s” increases the snaplength, grabbing the whole packet


# tcpdump -nnvvXSs 1514

How change display resolution settings using xrandr

Xrandr is used to set the size, orientation and/or reflection of the outputs for a screen. It can also set the screen size. There are a few global options; the rest modify a particular output and follow the specification of that output on the command line.
Open the terminal and run the following commands
First you need to enter the following command
$ xrandr
This will display the allowed resolutions
Sample output

Screen 0: minimum 320 x 200, current 1024 x 768, maximum 4096 x 4096
VGA1 connected 800×600+0+0 (normal left inverted right x axis y axis) 267mm x 200mm
800×600 85.1* +
640×480 75.0 60.0
720×400 70.1
If you want to add a mode with resolution 1024X768, you can enter the following command: (The output is shown following.)
$ cvt 1024 768
Sample output

# 1024×768 59.92 Hz (CVT 0.79M3) hsync: 47.82 kHz; pclk: 63.50 MHz
Modeline "1024x768_60.00" 63.50 1024 1072 1176 1328 768 771 775 798 -hsync +vsync
Now you need to create a modeline
$ xrandr --newmode <Modeline>
copy the modeline of the previous output to the place mode line
$ xrandr --newmode "1024x768_60.00"   63.50  1024 1072 1176 1328  768 771 775 798 -hsync +vsync
Now you need to add the above mode using the following command
$ xrandr --addmode VGA1 1024x768_60.00
here for VGA1 you have to use what ever that was there for $ xrandr output
$ xrandr --output VGA1 --mode 1024x768_60.00
Running these would change your resolution but this is temporary.these steps were done to make sure that these commands work
Now we need to make these changes permanent
Now you need to edit the default file
$gksudo gedit /etc/gdm/Init/Default
Look for the following lines
PATH=/usr/bin:$PATH
OLD_IFS=$IFS
and Add the the following lines below them
xrandr --newmode "1024×768" 70.00 1024 1072 1176 1328 768 771 775 798 -hsync +vsync

xrandr --addmode VGA1 1024x768_60.00

xrandr --output VGA1 --mode 1024×768
Save and exit the file

Jumaat, 16 Januari 2015

ubuntu - how to stop apache2, mysql from starting automatically

MySQL is handled by upstart. In 11.04 you can use the new override feature to modify the starting behaviour:
echo "manual" >> /etc/init/mysql.override
Apache still uses traditional SysV init scripts so you use
 update-rc.d -f apache2 remove
to remove the links from /etc/rcX.d or, alternatively, use
 update-rc.d apache2 disable
which "disables" the script by changing it from a start script S91apache2 to a stop script K09apache2. This is reversible by update-rc.d apache2 enable.

---- Tested at ---
Distributor ID: Ubuntu
Description: Ubuntu 14.04.1 LTS
Release: 14.04
Codename: trusty

Ahad, 12 Mei 2013

View IP Address and Network Setting

A. Most basic and most popular comand - ifconfig

gnome@gnome-u:~$ ifconfig
eth0      Link encap:Ethernet  HWaddr 05:0f:b0:99:36:53
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
          Interrupt:21

eth1      Link encap:Ethernet  HWaddr 05:13:ce:99:69:d5
          inet addr:192.168.1.4  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::213:ceff:fe99:69d4/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:99123 errors:4 dropped:4 overruns:0 frame:0
          TX packets:88479 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:99532417 (99.5 MB)  TX bytes:9657254 (9.6 MB)

B. Another command - ip addr show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN 
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: eth0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast state DOWN qlen 1000
    link/ether 05:0f:b0:99:36:53 brd ff:ff:ff:ff:ff:ff
3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 05:13:ce:99:69:d5 brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.4/24 brd 192.168.1.255 scope global eth1
    inet6 fe80::213:ceff:fe99:69d5/64 scope link 
       valid_lft forever preferred_lft forever

C. Newer but more info - nm-tool
NetworkManager Tool

State: connected (global)

- Device: eth1  [Auto XXXWifi] -------------------------------------------------
  Type:              802.11 WiFi
  Driver:            ipw2200
  State:             connected
  Default:           yes
  HW Address:        05:13:CE:99:69:D5

  Capabilities:
    Speed:           36 Mb/s

  Wireless Properties
    WEP Encryption:  yes
    WPA Encryption:  yes
    WPA2 Encryption: yes

  Wireless Access Points (* = current AP)
    *XXXwifi:        Infra, 05:1E:E3:EF:E7:93, Freq 2412 MHz, Rate 54 Mb/s, Strength 76 WPA2
    TP-LINK_B1EF81:  Infra, F5:D1:11:B1:EF:82, Freq 2457 MHz, Rate 54 Mb/s, Strength 49 WPA2

  IPv4 Settings:
    Address:         192.168.1.4
    Prefix:          24 (255.255.255.0)
    Gateway:         192.168.1.1

    DNS:             192.168.1.1


- Device: eth0 -----------------------------------------------------------------
  Type:              Wired
  Driver:            b44
  State:             unavailable
  Default:           no
  HW Address:        05:0F:B0:99:36:53

  Capabilities:
    Carrier Detect:  yes

  Wired Properties
    Carrier:         off

Selasa, 7 Mei 2013

How To Insert Link Into Your Blog Comments

Here are some simple steps on how to insert a link into your comment. Just copy the code below and change the link location and link name in the given html code with your own data. That's it!

<a href="link location">link name</a>

<a href="http://afterdarkwrites.blogspot.com">AFTERDARK WRITES!</a>

Rabu, 14 November 2012

3rd Party Repository: Google Chrome


This repository is available for: Stable 

Title:Chrome browser in Google repos
Description:Google Linux repository on dl.google.com.
Daily Build:no
Setup key with:
wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add - 

Setup repository with:
sudo sh -c 'echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list'
Setup package with:
sudo apt-get update 
sudo apt-get install 
where is the name of the package you want to install.

Sabtu, 17 Mac 2012

Khamis, 15 Mac 2012

enable mod userdir under apache2

Apache2 mod userdir give each user in Ubuntu system have access their home folder under public_html. All web files, web system, etc must be put under this public_html. User or anybody can access that files/web system in any web browser using http://localhost/~username (locally) or http://ip-address/~username (in the network/intranet). Below is the command to enable the userdir mod.

1. sudo a2enmod userdir
2. service apache2 restart

To enable php you need to comment out ifModule userdir in php5.conf

Selasa, 3 Januari 2012

Mount qemu harddisk image in linux

1. Check the image format
qemu-img info image.img
image: image.img
file format: qcow2
virtual size: 2.0G (2147483648 bytes)
disk size: 201M
cluster_size: 65536
2. second step is to convert the image format to RAW format:

qemu-img convert –f qcow2 image.img –O raw image-raw.img

3. get the offset for mount option

fdisk -u -l image-raw.img

Disk image-raw.img: 2147 MB, 2147483648 bytes
255 heads, 63 sectors/track, 261 cylinders, total 4194304 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
Device Boot Start End Blocks Id System
image-raw.img1 * 16065 4192964 2088450 83 Linux

Then I have the sector size (512 in my case) and the offset (16065, start sector of my partation), so the offset should be 512*16065= 8225280 (btw, you can calculate with bc: echo ‘512*16065’ | bc)

4. Create mount point mkdir /mnt/image

5. mount the image

mount -t ext4 -o loop,offset=8225280 image-raw.img /mnt/image

file type (-t ext4 ) can be identify from fdisk output above. System -- Linux. alternatively you can run the image under qemu to see the OS. i.e qemu image-raw.img


Selasa, 29 November 2011

Compiling/Running Java Programs in Notepad++


Notepad++ is a free (as in "free speech" and also as in "free beer") source code editor and Notepad replacement that supports several languages. Running in the MS Windows environment, its use is governed by GPL License.

Based on the powerful editing component Scintilla, Notepad++ is written in C++ and uses pure Win32 API and STL which ensures a higher execution speed and smaller program size. By optimizing as many routines as possible without losing user friendliness, Notepad++ is trying to reduce the world carbon dioxide emissions. When using less CPU power, the PC can throttle down and reduce power consumption, resulting in a greener environment.

Download at http://notepad-plus-plus.org/download/

To compile and execute java class file, just install NPPExec plugin (Plugins --> Plugin Manager --> Show Plugin Manager), restart N++.
Write a simple Hello World java file and press F6. Enter the following code -->

javac "$(FULL_CURRENT_PATH)"
java -classpath "$(CURRENT_DIRECTORY)" "$(NAME_PART)"

Jumaat, 14 Oktober 2011

reinstall grub2 after windows setup

This operation will write to the MBR and restore the modules and core.img to /boot/grub. It will not replace or restore grub.cfg or fix corrupted files.

  1. Boot the LiveCD Desktop.
  2. Open a terminal by selecting Applications, Accessories, Terminal from the menu bar.

  3. Determine the partition with the Ubuntu installation. The fdisk option "-l" is a lowercase "L".

    1. sudo fdisk -l
      If the user isn't sure of the partition, look for one of the appropriate size or formatting.

      Running sudo blkid may provide more information to help locate the proper partition, especially if the partitions are labeled. The device/drive is designated by sdX, with X being the device designation. sda is the first device, sdb is the second, etc. For most users the MBR will be installed to sda, the first drive on their system. The partition is designated by the Y. The first partition is 1, the second is 2. Note the devices and partitions are counted differently.

  4. Mount the partition containing the Ubuntu installation.
    sudo mount /dev/sdXY /mnt

    Example: sudo mount /dev/sda1 Note: If the user has a separate /boot partition, this must be mounted to /mnt/boot Note: If the user has a separate /home partition, this must be mounted to /mnt/home. Encrypted home partitions should work.

  5. Run the grub-install command as described below. This will reinstall the GRUB 2 files on the mounted partition to the proper location and to the MBR of the designated device.

    sudo grub-install --root-directory=/mnt /dev/sdX

    Example: sudo grub-install --root-directory=/mnt /dev/sda


Rabu, 4 Mei 2011

Ubuntu 11.04 - freezes during or after booting the system

If you install Ubuntu on 11.04, or other distros with latest Linux kernel, or if you update to latest kernel (2.6.38 and +), you might experience freezes during or after booting the system. If system boots without freezing, your wired connection is going up and down constantly. This is related to either power management of the PCIe bus bug, BIOS issues or most possibly a driver (JMicron) related bug. The fix for this is to add 'pcie_aspm=off' to your kernel boot options.

On Ubuntu is in the /etc/default/grub file, it should look like this:
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash pcie_aspm=off".

On other systems, find the kernel boot options and add 'pcie_aspm=off' to it. I am guessing that the NP8150 and NP8170 are also susceptible to this problem as well.

Happy Linuxing!

Isnin, 2 Mei 2011

Fedora installation using ISO/Grub2

n an Ubuntu intstallation, I created a directory called iso. I copied the iso into it. I then mounted the iso with -o loop and copied over isolinux/vmlinuz and initrd.img to the same directory containing the iso image. So, in my Ubuntu / partition, I have a directory called iso containing F14.iso, initrd.img and vmlinuz.

I then booted into an old Fedora install (that I was planning to overwrite.) The Ubuntu partition was /dev/sda6. So, I added to the old Fedora grub.conf

title Fedora Boot
root (hd0,5)
kernel (hd0,5)/iso/vmlinuz fromiso=/iso/f14.iso
initrd (hd0,5)/iso/initrd.img

ISO Booting with Grub 2

Need to unmounted the /isodevice,

using sudo umount -l -r -f /isodevice

Jumaat, 29 April 2011

Ubuntu Unity Keyboard Shortcuts


Unity Shortcuts

  • Super (Win key) – This open the activities menu (Launcher)
  • Super+A – Brings up the applications menu and allows you to perform search
  • Super+F1 – Focuses on the Launcher, use arrow keys to navigate and press enter to select
  • Super+W – Expo mode, zoom out on all windows in all workspace and lets you to move them
  • Shift+Alt+ Up - Expo mode for all windows in the current workspace only
  • Super+D – Minimize all windows; hitting it again restores them
  • CTRL+Alt+Left/Right/Up/Down – Change to a new workspace
  • Super+S – Expo mode, zooms out on all the workspaces and let’s you manage windows
  • Super+F - Opens Files & Folders menu

Window Shortcuts

These shortcuts can be used in any environment as well in Unity.

  • Alt+Tab – Switches between currently open windows
  • Alt+F7 – Moves the current window (can be moved with mouse or keyboard)
  • Alt+F8 – Resizes current window (again,can be moved with mouse or keyboard)
  • Alt+F9 – Minimises current window
  • Alt+F10 - Maximises current window
  • Alt+Space – Brings up window menu with various options as minimize, maximize, move…etc
  • Alt+F5 – Returns window to ‘normal’ or previous size
  • Alt+F4 – Closes window

Terminal Shortcuts

You can use these shortcuts when you are using the terminal (Ctrl+Alt+T).

  • Ctrl + A – Move cursor to beginning of line
  • Ctrl + E – Move cursor to end of line
  • Ctrl + C – kills the current process
  • Ctrl + Z – sends the current process to the background
  • Ctrl + D – logs you out
  • Ctrl + R – finds the last command matching the entered letters
  • Enter a letter, followed by Tab + Tab – lists the available commands beginning with those letters
  • Ctrl + U – deletes the current line
  • Ctrl + K – deletes the command from the cursor right
  • Ctrl + W – deletes the word before the cursor
  • Ctrl + L – clears the terminal output
  • Shift + Ctrl + C – copy the highlighted command to the clipboard
  • Shift + Ctrl + V (or Shift + Insert) – pastes the contents of the clipboard
  • Alt + F – moves forward one word
  • Alt + B – moves backward one word
  • Arrow Up/Down – browse command history
  • Shift + PageUp / PageDown – Scroll terminal output

Compiz Shortcuts

Some of these shortcuts requires Compiz Desktop effects enabled.

  • Alt + Tab – switch between open windows
  • Win + Tab – switch between open windows with Shift Switcher or Ring Switcher effect
  • Win + E – Expo, show all workspace
  • Ctrl + Alt + Down – Film Effect
  • Ctrl + Alt + Left mouse button – Rotate Desktop Cube
  • Alt + Shift + Up – Scale Windows
  • Ctrl + Alt + D – Show Desktop (Only in GNOME)
  • Win + Left mouse button – take screenshot on selected area
  • Win + Mousewheel – Zoom In/Out
  • Alt + Mousewheel - Transparent Window
  • Alt + F8 – Resize Window
  • Alt + F7 – Move Window
  • Win + P – Add Helper
  • F9 - show widget layer
  • Shift + F9 – show water effects
  • Win + Shift + Left mouse button – Fire Effects
  • Win + Shift + C – Clear Fire Effects
  • Win + Left mouse button – Annotate: Draw
  • Win + 1 – Start annotation
  • Win + 3 – End annotation
  • Win + S – selects windows for grouping
  • Win + T – Group Windows together
  • Win + U – Ungroup Windows
  • Win + Left/Right – Flip Windows

Nautilus Shortcuts

You might want to remember some these combinations like the one to create new folder or rename a file.

  • Shift + Ctrl + N – Create New Folder
  • Super + T - Opens the Trash can (recycle bin)
  • Alt + Home – Opens Home
  • Ctrl + T – Delete selected file(s) to trash
  • Alt + ENTER – Show File/Folder Properties
  • Ctrl + 1 – Toggle View As Icons
  • Ctrl + 2 – Toggle View As List
  • Shift + Right – Open Directory (Only in List View)
  • Shift + Left – Close Directory (Only in List View)
  • Ctrl + S – Select Pattern
  • F2 – Rename File
  • Ctrl + A – Select all files and folders
  • Ctrl + W – Close Window
  • Ctrl + Shift + W – Close All Nautilus Windows
  • Ctrl + R – Reload Nautilus Window
  • Alt + Up – Open parent directory
  • Alt + Left – Back
  • Alt + Right – Forward
  • Alt + Home – go to Home folder
  • Ctrl + L – go to location bar
  • F9 – Show sidepane
  • Ctrl + H – Show Hidden Files
  • Ctrl + + – Zoom In
  • Ctrl + - – Zoom Out
  • Ctrl + 0 – Normal Size

Common Application Shortcuts

These shortcuts do not apply in all applications, but usually perform the functions listed below.

  • Ctrl + C – Copy the selected text/object
  • Ctrl + X - Cut the selected text/object
  • Ctrl + V – Paste/insert the selected text/object
  • Ctrl + A – Select all text
  • Ctrl + B – Make the selected text bold
  • Ctrl + I – Make the selected text italic
  • Ctrl + U - Underline the selected text
  • Ctrl + N - Open a new document or window
  • Ctrl + S - Save the current document
  • Ctrl + O - Open another document
  • Ctrl + P - Print the current document
  • Ctrl + Z - Undo the last change you made
  • Ctrl + Shift + Z - Redo a change that you just undid
  • Ctrl + Q – Quit the current application

Useful Shortcuts

  • Alt + F2 Run an application by typing its name in the box which appears
  • Prt Sc (Print Screen) Take a screenshot of the whole screen
  • Alt + Prt Sc Take a screenshot of the current window
  • Alt+Ctrl+Del – Restart the system
  • Alt+Ctrl+L - Lock the screen

Mouse Tricks

  • Tiling – Dragging a Window to the left/right border will auto tile it to that side of the screen
  • Maximization – Dragging a window to the top panel will maximize it
  • Unmaximize – Dragging the top panel down on a maximized window will unmaximize it

Khamis, 21 April 2011

Linux - Video Resolution Tools and Command

Useful command line tools

1. xresprobe [driver=vesa,ati,nv,nvidia,i810]
2. ddcprobe

In ubuntu is not install by default. To install apt-get install xresprobe

To check/modify resolution


1. xrandr


more info

http://ubuntuforums.org/showthread.php?t=83973

Isnin, 18 April 2011

Batch resize photo

In Linux, if you have installed ImageMagick suite, you can use a nifty command to resize images, photos or pictures. The name of the command line tool is mogrify. Here is how it is done.

Suppose you want to resize all your images to a size of 800×600.

You open a terminal and navigate to the directory containing your images, photos or pictures.

Create a directory in the location named “resized-pictures” as follows :

$ mkdir resized-pictures

Now run the mogrify command from the same location.

$ mogrify -path ./resized-pictures/ -resize 800x600 *.jpg

The above command will resize all the jpeg pictures in the current directory to a 800×600 size and save the output to the resized-pictures/ directory leaving the original pictures intact.

Note: You can also run the mogrify command without the -path option; in which case, all the images will be resized and overwritten in the current directory itself.

#!/bin/bash

for i in *.jpg
do

echo "I am resizing the $i image....."

# writes to a new file, the old one survives
#convert -resize 800x600 $i

# writes to the same file, the old one will vanish
mogrify -resize 800x600 $i

echo "Image $i has been resized."

done
REf:
1.http://www.devdaily.com/blog/post/linux-unix/use-imagemagick-mogrify-command-resize-images
2. http://linuxandfriends.com/2009/08/10/mogrify-how-to-resize-images-from-the-command-line/

Isnin, 7 Disember 2009

View mysql user



To show the users in a MySQL database, first login as an administrative user, then run this query: