Posts

Showing posts with the label console

How to create symbolic link in Mac Os Lion

ln -s <absolute_path> <name_of_link>

Counting a project line of codes with Console

find . -name "*.py" -print0 | xargs -0 wc -l For the actual repo ninja-ide (pull date: 21/11/11), its   17121 LoC Ninja-IDE (pull date: 27/10/11), 16562 LoC

Show hidden files in Mac Os Lion

Open Terminal and run: $ defaults write com.apple.Finder AppleShowAllFiles YES Relaunch Finder (hold alt key and right click on Finder, then Relaunch) To hide this files again run in Terminal: $ defaults write com.apple.Finder AppleShowAllFiles NO and also relaunch Finder as above. source

Delete all the "Thumbs.db" files - Mac Os Lion

First, find out how many of them you have, by running this command: find . -iname "Thumbs.db" And just run the following command in the base folder from where to erase them: find . -iname "Thumbs.db" -delete source

Extract audio (in mp3 format) from a .flv file - Ubuntu 11.04

Open a console and run: sudo apt-get install ffmpeg libavcodec-extra-52 ffmpeg -i file.flv -ar 44100 -ab 160 -ac 2 audio.mp3

Fix file permissions in Mac OS X

A few days ago I copied a bunch of files/folders from an external NTFS formatted hard drive to my MacBook. The files where copied ok, but the permissions where messed up. How did I fix them? With this simple command: $ chmod -Rv u=rwx,g=rx,o=r username path_to_base_folder It recursively goes through all files and folders and fix their permissions. Source!

Read and Write NTFS partition under Snow Leopard

This is experimental, and known to be unstable, use at your own risk. You need to modify /etc/fstab file to mount NTFS partitions for read and write. First, uninstall NTFS-3G/Paragon if installed. Open Terminal run diskutil info /Volumes/volume_name and copy the Volume UUID. Backup /etc/fstab if you have it (shouldn't be there in a default install).  Run sudo vim /etc/fstab and write: UUID=paste_the_uuid_here none ntfs rw or LABEL=volume_name none ntfs rw (if you don't have UUID for the disk). Repeat for other NTFS partitions. Restart your system. Thats all! source (great web)

Resize images with Preview (Snow Leopard)

Image
Alternative 1 A Quick way to resize images in batches could be find that Preview has that functionality. Open the whole batch of images in Preview; the images will all open in the same window with thumbnails visible in the sidebar. Select all of the thumbnails in the sidebar (with Command-A, or click the first and then click the last while holding Shift). Next, from the Tools menu, choose Adjust Size. You’ll be presented with a dialog containing options to resize to all the common 4:3 and 16:9 screen sizes, as well as the option to define custom dimensions. Images are scaled proportionately and resampled by default. snow leopard preview image resize Save the resized images, and you’re done! Preview will prompt you to save any changes if you attempt to close the window. Alternative 2 You can also use sips on the command line: sips -Z 1024 *.jpg will resample to a max of 1024 px for the long edge. Note that sips rewrites images in place, so you should do this on a copy if you care. s...

SCP (Secure Copy)

Copying file to host: scp SourceFile user @ host : directory / TargetFile Copying file from host: scp user @ host : / directory / SourceFile TargetFile scp user @ host : / directory / SourceFile TargetFolder Note that if the remote host uses a port other than the default of 22, you can specify it in the command. For example, copying a file from host: scp -P 2222 user @ host : directory / SourceFile TargetFile

Creating Iso files from directories

mkisofs -o name.iso directory

How to remove/install/reconfigure xorg without reinstalling ubuntu

Open terminal Remove existing xorg using the following command sudo apt-get remove --purge xserver-xorg Install xorg using the following command sudo apt-get install xserver-xorg Reconfigure xorg using the following command sudo dpkg-reconfigure xserver-xorg source: title link

Resize images from Console

convert name.jpg -resize 50% name.png

Cracking a Pdf Password

PDFCrack is a GNU/Linux (other POSIX-compatible systems should work too) tool for recovering passwords and content from PDF-files. It is small, command line driven without external dependencies. The application is Open Source (GPL). pdfcrack Features: Supports the standard security handler (revision 2 and 3) on all known PDF-versions Supports cracking both owner and userpasswords Both wordlists and bruteforcing the password is supported Simple permutations (currently only trying first character as Upper Case) Save/Load a running job Simple benchmarking Optimised search for owner-password when user-password is known Install pdfcrack in Ubuntu sudo aptitude install pdfcrack pdfcrack Syntax pdfcrack -f filename [options] pdfcrack Options -b, - -bench - Perform benchmark and exit. -c, - -charset=STRING - Use the characters in STRING as charset. -m, - -maxpw=INTEGER - Stop when reaching INTEGER as password length. -n, - -minpw=INTEGER - Skip trying passwords sho...

How to use find command

On Debian based distros, find is part of the package findutils . find allow one to search for files on a filesystem based on different condition, creation date, modified date, file size, file type, permissions, name .... This tutorial, will be focused on finding files/directories based on their name, in order to explain in more depth the syntax of find, also will show how you can narrow down your search by adding condition on size and file modification time. 1. Find basis The default syntax of find is as such: find [path] [expression] where path is the path used as root for searching pattern and expression the expression we want the file to match. 2. Finding a file based on filename Let say for instance you want to find all .avi files in users home directories. Search files can be found with the following command: # find /home -name '*.avi' If you want to search for *.mpg and *.avi files, you will use the following: find /home -name '*.mpg' -o -name '*....

sudo: port: command not found

If you install mac ports under Mac, then run sudo port install "app_here"  and you recieve this error (the title), i have the solution. One word. $PATH. Open your .bashrc file (if you dont have it, create it), and add these lines export PATH=/opt/local/bin:/opt/local/sbin/:$PATH export MANPATH=/opt/local/share/man:$MANPATH (the first, for the port command and the second for the manpages of port command. Yea, i know its obvious... :P) Ciao!

Split and Join files Linux

First we need a compressed file, tar -cvvzf file.tar.gz file.something Now, we split the compressed file, split -b 10M file.tar.gz "prefix_here" (parts of 10 megas with the prefix "prefix_here") To join the parts: cat "prefix_here"* > file_joined.tar.gz  And thats all! :)

Como escuchar la rock and pop desde Ubuntu

La opción mas conocida es bajarse el plugin para firefox de moonlight ... (cosa que hice y no me funcionó)... La segunda opción es, instalar mplayer y en terminal cargar la direccion con mplayer.  ie: mplayer mmsh:// streaming.fmroc kandpop.com/roc kandpop?MSWMExt =.asf (gracias darío que me pasó la solución! me cago en ms!) Chupate esta mandarina MS!! :D Sino desde Vlc desde este post Update(7/3/12) La nueva url es: mmsh://200.89.168.10:80/audio959-rockandpop?MSWMExt=.asf

Taking photos thru console

Image
ISight I always wondered, how about taking photos throught console? I mean, without using PhotoBooth. Making bash scripts that use the built-in camera would be awesome! One easy way is installing isightcapture .   This is how you can use it $ ./isightcapture image.jpg     will output a 640x480 image in JPEG format $ ./isightcapture -w 320 -h 240 -t png image.png     will output a scaled 320x240 image in PNG format Note: S eems the project has been discontinued.

Copy files with cp (fancy way)

Copy files from dir A to dir B. (cause i always forget wh ich are the proper flags...) cp -Rpnv "Dir_A" "Dir_b" n : Do not overwrite an existing file (overides -f flag). p : Preserves attributes for each source file. R : Files are copied recursively. v : Show files while copying them.

Mandar al procesador de pecho!!

Una alternativa es mantener las teclas Alt (izquierdo)+System Rescue (Print Screen) y escribir REISUB. donde R - Devuelve el control al teclado (Raw) E - Manda todos los procesos al term, es decir, los hace terminar (End) I - Manda los procesos al Kill. S - Sincroniza el disco duro (Sync) U - Desmonta todos los sistemas de ficheros (Unmount) B - Por último, reinicia el ordenador. (reBoot) nunca me acuerdo esto yo