Azitech

Azimout's Linux weblog

Win7 KVM guest maintainance

leave a comment »

I had some spare time yesterday, so I did a little bit of maintainance to my Win7 Ultimate virtual machine (on a KVM/Qemu host running Ubuntu 11.10):

  • Activated Windows so it would stop complaining
  • Installed a free antivirus (Avast)
  • Downloaded WSUS Offline and installed all updates
  • Installed Google Chrome
  • Installed the latest versions of Adobe Flash and Adobe Air
  • Changed the storage type from IDE to Virtio (much much faster!). It took some effort to get Red Hat’s virtio storage driver to work: in the end the problem was driver signing, and I needed to use the ”Driver Signature Enforcement Overrider”. Plus I had to use Virtual CloneDrive in order to mount the .iso file with the drivers
  • Used WinDirStat to get a picture of disk usage, disabled the pagefile and hibernating to save space
  • Removed the (virtual) sound card, as it was messing with the host’s sound

Written by azimout

29/12/2011 at 08:17

Posted in Tricks

Google’s 2-step verification

leave a comment »

Google 2-step verification is a great step forward for security! It can be a little daunting at first, but once you have everything setup I think the increased security is well worth the effort spent.

What it does is basically to break the well-established paradigm of “one-account-one-password”. Instead, one account has multiple passwords, which are called “application-specific passwords“. The idea is that, e.g. if you setup to read your Gmail on your smartphone and then you lose it, you can revoke that password without having to change the password you use to read Gmail on your browser! These passwords are 16 characters long.

In addition to the application-specific passwords, you also have one-time passwords (called “verification codes“) that are used (in addition to your normal password) for signing into your account using a browser. These codes are 6 digits long. You can have them sent to you by SMS, or you can install the “Google Authenticator” app on your smartphone to have the verification codes generated by your phone each time.

Google 2-step verification:
http://support.google.com/accounts/bin/static.py?hl=en&topic=1056284&guide=1056283&page=guide.cs

Google Authenticator, the app that turns your smartphone into a token:
http://support.google.com/accounts/bin/answer.py?hl=en&answer=1066447

Written by azimout

12/12/2011 at 15:21

Posted in News

Delete a long list of files

leave a comment »

Say you wanna search your filesystem for files matching certain criteria and remove them. Here’s how to do it:

Create a text file containing the list of files you want to remove, e.g. like this:

locate abcd | /bin/grep /usr/local > filelist.txt

Inspect filelist.txt carefully to make sure you’re not removing anything you want to keep. Then remove those files like this:

for i in `cat filelist.txt`; do sudo rm -r $i; done

Written by azimout

31/10/2011 at 15:17

Posted in Howto

Colourise MacOSX terminal

leave a comment »

Edit the file /etc/bashrc and add/modify the following:

export CLICOLOR=1
export LSCOLORS=ExFxCxDxBxegedabagacad
PS1='\[33[;32m\]\u@\h\[33[m\]:\[33[;34m\]\w\[33[m\]\$ '

Written by azimout

28/10/2011 at 12:51

Posted in Tricks

Python modules installed through MacPorts

leave a comment »

MacOSX already includes the Python interpreter. However, if you install Python modules using MacPorts, you won’t be able to import them in your Python programs (ImportError: No module named <module name>).

The reason is that Apple’s Python doesn’t “see” the modules installed through MacPorts; you need to use MacPorts’s Python.

To see a list of available Python interpreters, run port select python. Then to choose e.g. MacPorts’s Python 2.6, run sudo port select python python26

Written by azimout

07/10/2011 at 09:44

Posted in Howto

A couple of Apache tricks

leave a comment »

Don’t restart, reload

After changing some configuration option, instead of restarting Apache (sudo service apache2 restart), try reloading instead (sudo service apache2 reload).

To add another “subdir” under your domain (i.e. http://mydomain/newsubdir/), create the file /etc/apache2/sites-available/newsubdir:

<VirtualHost *:80>
    Options FollowSymLinks MultiViews
    Alias /newsubdir/ "/path/to/content/"
</VirtualHost>

Then enable the site with sudo a2ensite newsubdir and then reload the Apache configuration as described above.

Written by azimout

03/10/2011 at 14:14

Posted in Howto

Matplotlib font manager error

leave a comment »

A Python script that used to work on my machine stopped working at some point. It’s the script presented in the post Designing a Butterworth low-pass filter with SciPy. The last few lines of the traceback were:

File "/usr/lib/pymodules/python2.7/matplotlib/font_manager.py", line 1306, in findfont
   if not os.path.exists(font):
 File "/usr/lib/python2.7/genericpath.py", line 18, in exists
   os.stat(path)
 TypeError: coercing to Unicode: need string or buffer, dict found

Through this thread I was able to resolve the issue by clearing matplotlib’s font cache: rm ~/.matplotlib/fontList.cache

Written by azimout

01/09/2011 at 13:03

Posted in Problems

iOS for Linux users

leave a comment »

iOS – like Mac OS X – is a Darwin-based operating system, which in turn is based on the XNU kernel. It is POSIX-compliant and “Unix-like”, but it is NOT Linux-based.

The output of “uname -a” on my iPhone is:

Darwin <device name> 11.0.0 Darwin Kernel Version 11.0.0: Wed Mar 30 18:51:10 PDT 2011; root:xnu-1735.46~10/RELEASE_ARM_S5L8930X iPhone3,1 arm N90AP Darwin

USB cable

When connected to a Ubuntu machine through the USB cable, two locations will be mounted over the AFC (Apple File Connection) protocol. The two mount points will be titled “<device name>” and “Documents on <device name>“. Ubuntu 11.04 will offer (in Nautilus) to open the first mount point with the Banshee Media Player and with the Shotwell Photo Manager.

SSH

On a jailbroken iPhone you can install OpenSSH. The default username is “mobile” and the default password (on ALL iPhones) is “alpine”. Change that immediately with “passwd”. Note your iPhone’s IP address on the WiFi interface (you can find that under Settings, Wi-Fi, then click on the blue right arrow; if you’re doing this at home, you might want to reserve a fixed IP address for your iPhone on your router).

Filesystem

The flash storage is divided into to HFS-formatted partitions; one is mounted under / (root) and the other under /private/var. Only the second one is journaled.

A few soft links exist at root level:

  • /var -> /private/var
  • /etc -> /private/etc
  • /User -> /var/mobile
  • /tmp -> /private/var/tmp
  • /Applications -> /var/stash/Applications.pwn

Your home directory will be “/var/mobile”. The first mount point described above (“<device name>”) is actually “/var/mobile/Media”

See also

Written by azimout

31/08/2011 at 19:40

Posted in Reference

Difference between make clean and make distclean

leave a comment »

Basically, if make built it, then make clean should delete it; whereas if configure built it, then make distclean should delete it.

Reference: http://www.gnu.org/software/automake/manual/automake.html#Clean

Written by azimout

28/08/2011 at 15:12

Posted in Reference

Convert Youtube video to .mp3 locally

leave a comment »

Yes, there are online services that do that for you, like video2mp3, but where’s the fun in that? Besides, those services might go away, they might be down when you need them, or they might start charging you money.

Instead, you can do it on your machine, using youtube-dl (written in Python). Download the script and run it with the --extract-audio command-line option. You’ll need also ffmpeg, lame and libavcodec-extra-52

Written by azimout

17/08/2011 at 21:42

Posted in Howto

Follow

Get every new post delivered to your Inbox.

Join 73 other followers