The Archives

  • 25.Oct.12
    utf-8 blues in snow leopard with mutt and vim shell | pfortuny | (0)
    Yes, it looks like a true spam page. But it is the only way to describe my problem. I was trying to set up mutt (yes, I am a bit fed up with Mail.app and its inability to be controlled with the keyboard alone in any sensible way). Terminal.app seems to work OK with utf-8. However, the included vim does not. Any time you type an accented char and delete it, the text gets mangled (you know, typical off-by-one cursor position). The solution for vim is incredibly stupid: open up vim and write :set encoding=utf-8 (or do that at any ...
  • 21.Dec.09
    Mounting and unmounting a disk image (dmg) in OS X shell | rafacas | (0)
    A file with the extension .dmg uses a proprietary disk image format commonly found on Mac OS X (well, usually: you can use any extension anywhere, obviously) . The command used for manipulating disk images is hdiutil $ hdiutil attach nmap-5.00.dmg esperado CRC32 $C955C266 /dev/disk2 Apple_partition_scheme /dev/disk2s1 Apple_partition_map /dev/disk2s2 ...
  • 06.Sep.09
    How to verify MD5 or SHA-1 digests security | rafacas | (2)
    MD5 and SHA-1 are cryptographic hash functions. They are deterministic procedures that take an arbitrary block of data as input and return a fixed-size bit string, the hash value (called message digest or fingerprint as well). Verifying MD5 or SHA-1 digest is highly recommended when you download new software for your system. In most of Linux distros the md5sum and sha1sum commands are available: $ md5sum ubuntu-9.04-desktop-i386.iso 66fa77789c7b8ff63130e5d5a272d67b ubuntu-9.04-desktop-i386.iso $ sha1sum ubuntu-9.04-desktop-i386.iso 19aabf327fdbde9e66db54dc04e3a83b92f70280 ubuntu-9.04-desktop-i386.iso Solaris (even version 10) doesn’t ship either with md5sum or sha1sum installed. However you can use digest: % /usr/bin/digest -a md5 GNUgcc.3.4.4.SPARC.64bit.Solaris.10.pkg.tgz 498c344fe2839631bb7cf4b869b7b830 % /usr/bin/digest -a sha1 GNUgcc.3.4.4.SPARC.64bit.Solaris.10.pkg.tgz a8da8247900dd06a7000fd0e6d41f834d6ab3e40 And in Mac OS X, ...
  • 20.Apr.09
    Monitoring HTTP requests from the command line network | rafacas | (0)
    Some days ago Javisantana sent me a tweet with a link to a one-liner HTTP requests monitor. It goes as follows with some ouput added: $ sudo tcpdump -i en1 -n -s 0 -w - | grep -a -o -E "Host\: .*|GET \/.*" Password: tcpdump: listening on en1, link-type EN10MB (Ethernet), capture size 65535 bytes GET / HTTP/1.1 Host: commandliners.com GET / HTTP/1.1 Host: google.com GET / HTTP/1.1 Host: www.google.com GET / HTTP/1.1 Host: www.google.es GET /intl/en_com/images/logo_plain.png HTTP/1.1 Host: www.google.es [...] Replace en1 with your network interface's name. Usually enX in BSD-like OSes and ethX in Linux. You can create an alias named httpdump and add it to ~/.bash_profile: alias httpdump='sudo tcpdump -i en1 -n -s 0 -w ...
  • 04.Feb.09
    Batch convert RTF to PDF automated, scripts, shell | pfortuny | (0)
    You've got the full details here (the OpenOffice Forum site). After following the instructions there, I was able to convert a bunch of some 500 rtf files into pdf's with the following single 'line of code' (although there must be a newline after the first quote ') $ find /Users/pedrofortunyayuso/Desktop/fichitas -name "*rtf" | while read -r i ; do /Applications/NeoOffice.app/Contents/MacOS/soffice -invisible "macro:///Standard.MyConversions.SaveASPDF($i)" ; done All the above shows my computer as an evident OS X, but this works on Windows (the referred site does the job on Windows, using, obviously a different shell construct) and, as far as I know, on ...
  • 25.Jan.09
    Locking a user account shell | rafacas | (3)
    # passwd -l user Locks user's account, that is, prevents user from logging in. Note: This option is available in Linux and Solaris. In Mac OS X, -l option means something different: # passwd -l location user Here, -l changes the password in location. Valid values are: file: a filename. Default is /etc/master.passwd netinfo: a domain name or server/tag pair nis: an NIS domain name opendirectory: a directory node name
  • 19.Oct.08
    Your Mac terminal can sing fun | rafacas | (0)
    Typing say something into your Mac's terminal will literally make your Mac say something. The UsingMac blog posts a quick tip with this Mac built-in voice, so you can make your Mac sing. Copy and paste the following to the command line to check out your terminal "singing" ability. say -v Good oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo Get more terminal songs at Terminal sings songs (UsingMac) I know, this is not very useful, but it is fun :)
  • 15.Oct.08
    Safe remove cmd | rafacas | (0)
    rm -P file.txt Overwrite regular files before deleting them. Files are overwritten three times, first with byte pattern 0xff, then 0x00, and last with 0xff, before they are deleted.