jueves, 10 de abril de 2014

Fix Windows XP Activation Infinite Loop


1 - Start windows XP in safe mode with Comand Prompt
    - Boot the computer
    - Press F8 until the menu apears
    - Select : Safe Mode with Command Prompt
2 - In the command prompt write "explorer.exe" and hit Enter
3 - In the dialog box select "Yes"
4 - Go to "Start" and "Run"
5 - Type "rundll32.exe syssetup,SetupOobeBnk" and press OK
6 - Restart the computer

jueves, 3 de abril de 2014

Vim scheme in Tmux session

If the Vim scheme (or other programs) are not shown in a Tmux session, you just need to indicate to Tmux to use 256 colour palette. It can be done by calling Tmux with "-2" parameter, or setting the environment variable TERM appropriately.

The best option I found is adding an alias into your .bashrc (in case of bash shell) with the appropriate tmux call.

alias tmux="tmux -2"
This one seems to give same results for me:

alias tmux="TERM=screen-256color-bce tmux"

jueves, 27 de febrero de 2014

Dropbox need superuser

For some reason Dropbox started asking about superuser password... However it does not need acces to other folders than user ones. It seems that there is one problem with one of the paths in its python code. Just find the path to dropbox executable:

$ which dropbox
/usr/bin/dropbox

then modify with root privileges this file.

sudo vi /usr/bin/dropbox

The incorrect line is the first of these two lines:
PARENT_DIR = os.path.expanduser("/var/lib/dropbox")
DROPBOXD_PATH = "%s/.dropbox-dist/dropboxd" % PARENT_DIR

In my case the first one needs to point to my home, then it looks like this:

PARENT_DIR = os.path.expanduser("~")

Then start dropbox

$ dropbox start -i

source: http://blog.ishans.info/2013/12/26/fixing-authentication-is-needed-to-run-usrbindropbox-as-the-super-user-error-in-linux/

miércoles, 26 de febrero de 2014

Window tiling on Ubuntu 12

To configure tiling shortcuts on Ubuntu 12

Open the CompizConfig Settings manager
$ ccsm
filter the word "grid"
Select the result
Configure the different options

source: http://askubuntu.com/questions/334559/how-can-i-setup-hotkeys-for-tiling-individual-windows-in-unity-ubuntu-12-04

ALT+TAB not switching windows

Ubuntu 12.04.4 LTS

if the key combination ALT+TAB does not switch windows it may be disable in Compiz.
In order to enable it again try these steps:

# Open CompizConfig setting manager
$ ccsm

Then go to the tab Window management
and check application switcher

domingo, 17 de noviembre de 2013

Greek Unicode and Inkscape

To get Greek letters in Inkscape:

– go into text mode
– type Ctrl+U
– type the 4-digit unicode for the desired Greek letter.
Greek letter
Lower case
Unicode
Upper case
Unicode
alpha
α
03b1
A
0391
beta
β
03b2
B
0392
gamma
γ
03b3
Γ
0393
delta
δ
03b4
Δ
0394
epsilon
ϵ
03b5
E
0395
zeta
ζ
03b6
Z
0396
eta
η
03b7
H
0397
theta
θ
03b8
Θ
0398
iota
ι
03b9
I
0399
kappa
κ
03ba
K
039a
lambda
λ
03bb
Λ
039b
mu
μ
03bc
M
039c
nu
ν
03bd
N
039d
xi
ξ
03be
Ξ
039e
omicron
o
03bf
O
039f
pi
π
03c0
Π
03a0
rho
ρ
03c1
P
03a1
sigma
σ
03c3
Σ
03a3
tau
τ
03c4
T
03a4
upsilon
υ
03c5
ϒ
03a5
phi
ϕ
03c6
Φ
03a6
chi
χ
03c7
X
03a7
psi
ψ
03c8
Ψ
03a8
omega
ω
03c9
Ω
03a9

lunes, 18 de marzo de 2013

Añadiendo columnas a nautilus

Para añadir más columnas en Nautilus al visualizar en modo lista.
sudo apt-get install python-nautilus python-mutagen python-pyexiv2 python-kaa-metadata
mkdir ~/.nautilus/python-extensions
cp bsc.py ~/.nautilus/python-extensions
#!/usr/bin/python

# this script can installed to the current user account by running the following commands:

# sudo apt-get install python-nautilus python-mutagen python-pyexiv2 python-kaa-metadata
# mkdir ~/.nautilus/python-extensions
# cp bsc.py ~/.nautilus/python-extensions
# chmod a+x ~/.nautilus/python-extensions/bsc.py

# alternatively, you can be able to place the script in:
# /usr/lib/nautilus/extensions-2.0/python/

# change log:
# geb666: original bsc.py, based on work by Giacomo Bordiga
# jmdsdf: version 2 adds extra ID3 and EXIF tag support
# jmdsdf: added better error handling for ID3 tags, added mp3 length support, distinguished
#         between exif image size and true image size
# SabreWolfy: set consistent hh:mm:ss format, fixed bug with no ID3 information 
#             throwing an unhandled exception
# jmdsdf: fixed closing file handles with mpinfo (thanks gueba)
# jmdsdf: fixed closing file handles when there's an exception (thanks Pitxyoki)
# jmdsdf: added video parsing (work based on enbeto, thanks!)
# jmdsdf: added FLAC audio parsing through kaa.metadata (thanks for the idea l-x-l)
# jmdsdf: added trackno, added mkv file support (thanks ENigma885)
# jmdsdf: added date/album for flac/video (thanks eldon.t)
# jmdsdf: added wav file support thru pyexiv2
# jmdsdf: added sample rate file support thru mutagen and kaa (thanks for the idea N'ko)
# jmdsdf: fix with tracknumber for FLAC, thanks l-x-l
# draxus: support for pdf files
 
import os
import urllib
import nautilus
# for id3 support
from mutagen.easyid3 import EasyID3
from mutagen.mp3 import MPEGInfo
# for exif support
import pyexiv2
# for reading videos. for future improvement, this can also read mp3!
import kaa.metadata
# for reading image dimensions
import Image
# for reading pdf
try:
 from pyPdf import PdfFileReader
except:
 pass

class ColumnExtension(nautilus.ColumnProvider, nautilus.InfoProvider):
 def __init__(self):
  pass

 def get_columns(self):
  return (
   nautilus.Column("NautilusPython::title_column","title","Title","Song title"),
   nautilus.Column("NautilusPython::album_column","album","Album","Album"),
   nautilus.Column("NautilusPython::artist_column","artist","Artist","Artist"),
   nautilus.Column("NautilusPython::tracknumber_column","tracknumber","Track","Track number"),
   nautilus.Column("NautilusPython::genre_column","genre","Genre","Genre"),
   nautilus.Column("NautilusPython::date_column","date","Date","Date"),
   nautilus.Column("NautilusPython::bitrate_column","bitrate","Bitrate","Audio Bitrate in kilo bits per second"),
   nautilus.Column("NautilusPython::samplerate_column","samplerate","Sample rate","Sample rate in Hz"),
   nautilus.Column("NautilusPython::length_column","length","Length","Length of audio"),
   nautilus.Column("NautilusPython::exif_datetime_original_column","exif_datetime_original","EXIF Dateshot ","Get the photo capture date from EXIF data"),
   nautilus.Column("NautilusPython::exif_software_column","exif_software","EXIF Software","EXIF - software used to save image"),
   nautilus.Column("NautilusPython::exif_flash_column","exif_flash","EXIF flash","EXIF - flash mode"),
   nautilus.Column("NautilusPython::exif_pixeldimensions_column","exif_pixeldimensions","EXIF Image Size","Image size - pixel dimensions as reported by EXIF data"),
   nautilus.Column("NautilusPython::pixeldimensions_column","pixeldimensions","Image Size","Image/video size - actual pixel dimensions"),
  )

 def update_file_info(self, file):
  # set defaults to blank
  file.add_string_attribute('title', '')
  file.add_string_attribute('album', '')
  file.add_string_attribute('artist', '')
  file.add_string_attribute('tracknumber', '')
  file.add_string_attribute('genre', '')
  file.add_string_attribute('date', '')
  file.add_string_attribute('bitrate', '')
  file.add_string_attribute('samplerate', '')
  file.add_string_attribute('length', '')
  file.add_string_attribute('exif_datetime_original', '')
  file.add_string_attribute('exif_software', '')
  file.add_string_attribute('exif_flash', '')
  file.add_string_attribute('exif_pixeldimensions', '')
  file.add_string_attribute('pixeldimensions', '')

  if file.get_uri_scheme() != 'file':
   return

  # strip file:// to get absolute path
  filename = urllib.unquote(file.get_uri()[7:])
  
  # mp3 handling
  if file.is_mime_type('audio/mpeg'):
   # attempt to read ID3 tag
   try:
    audio = EasyID3(filename)
    # sometimes the audio variable will not have one of these items defined, that's why
    # there is this long try / except attempt
    try: file.add_string_attribute('title', audio["title"][0])
    except: file.add_string_attribute('title', "[n/a]")
    try: file.add_string_attribute('album', audio["album"][0])
    except: file.add_string_attribute('album', "[n/a]")
    try: file.add_string_attribute('artist', audio["artist"][0])
    except: file.add_string_attribute('artist', "[n/a]")
    try: file.add_string_attribute('tracknumber', audio["tracknumber"][0])
    except: file.add_string_attribute('tracknumber', "[n/a]")
    try: file.add_string_attribute('genre', audio["genre"][0])
    except: file.add_string_attribute('genre', "[n/a]")
    try: file.add_string_attribute('date', audio["date"][0])
    except: file.add_string_attribute('date', "[n/a]")
   except:
    # [SabreWolfy] some files have no ID3 tag and will throw this exception:
    file.add_string_attribute('title', "[no ID3]")
    file.add_string_attribute('album', "[no ID3]")
    file.add_string_attribute('artist', "[no ID3]")
    file.add_string_attribute('tracknumber', "[no ID3]")
    file.add_string_attribute('genre', "[no ID3]")
    file.add_string_attribute('date', "[no ID3]")
    
   # try to read MP3 information (bitrate, length, samplerate)
   try:
    mpfile = open (filename)
    mpinfo = MPEGInfo (mpfile)
    file.add_string_attribute('bitrate', str(mpinfo.bitrate/1000) + " Kbps")
    file.add_string_attribute('samplerate', str(mpinfo.sample_rate) + " Hz")
    # [SabreWolfy] added consistent formatting of times in format hh:mm:ss
    # [SabreWolfy[ to allow for correct column sorting by length
    mp3length = "%02i:%02i:%02i" % ((int(mpinfo.length/3600)), (int(mpinfo.length/60%60)), (int(mpinfo.length%60)))
    mpfile.close()
    file.add_string_attribute('length', mp3length)
   except:
    file.add_string_attribute('bitrate', "[n/a]")
    file.add_string_attribute('length', "[n/a]")
    file.add_string_attribute('samplerate', "[n/a]")
    try:
     mpfile.close()
    except: pass
 
  # image handling
  if file.is_mime_type('image/jpeg') or file.is_mime_type('image/png') or file.is_mime_type('image/gif') or file.is_mime_type('image/bmp'):
   # EXIF handling routines
   try:
    img = pyexiv2.Image(filename)
    img.readMetadata()
    file.add_string_attribute('exif_datetime_original',str(img['Exif.Photo.DateTimeOriginal']))
    file.add_string_attribute('exif_software',str(img['Exif.Image.Software']))
    file.add_string_attribute('exif_flash',str(img['Exif.Photo.Flash']))
    file.add_string_attribute('exif_pixeldimensions',str(img['Exif.Photo.PixelXDimension'])+'x'+str(img['Exif.Photo.PixelYDimension']))
   except:
    # no exif data?
    file.add_string_attribute('exif_datetime_original',"")
    file.add_string_attribute('exif_software',"")
    file.add_string_attribute('exif_flash',"")
    file.add_string_attribute('exif_pixeldimensions',"")
   # try read image info directly
   try:
    im = Image.open(filename)
    file.add_string_attribute('pixeldimensions',str(im.size[0])+'x'+str(im.size[1]))
   except:
    file.add_string_attribute('pixeldimensions',"[image read error]")

  # video/flac handling
  if file.is_mime_type('video/x-msvideo') | file.is_mime_type('video/mpeg') | file.is_mime_type('video/x-ms-wmv') | file.is_mime_type('video/mp4') | file.is_mime_type('audio/x-flac') | file.is_mime_type('video/x-flv') | file.is_mime_type('video/x-matroska') | file.is_mime_type('audio/x-wav'):
   try:
    info=kaa.metadata.parse(filename)
    try: file.add_string_attribute('length',"%02i:%02i:%02i" % ((int(info.length/3600)), (int(info.length/60%60)), (int(info.length%60))))
    except: file.add_string_attribute('length','[n/a]')
    try: file.add_string_attribute('pixeldimensions', str(info.video[0].width) + 'x'+ str(info.video[0].height))
    except: file.add_string_attribute('pixeldimensions','[n/a]')
    try: file.add_string_attribute('bitrate',str(round(info.audio[0].bitrate/1000)))
    except: file.add_string_attribute('bitrate','[n/a]')
    try: file.add_string_attribute('samplerate',str(int(info.audio[0].samplerate))+' Hz')
    except: file.add_string_attribute('samplerate','[n/a]')
    try: file.add_string_attribute('title', info.title)
    except: file.add_string_attribute('title', '[n/a]')
    try: file.add_string_attribute('artist', info.artist)
    except: file.add_string_attribute('artist', '[n/a]')
    try: file.add_string_attribute('genre', info.genre)
    except: file.add_string_attribute('genre', '[n/a]')
    try: file.add_string_attribute('tracknumber',info.trackno)
    except: file.add_string_attribute('tracknumber', '[n/a]')
    try: file.add_string_attribute('date',info.userdate)
    except: file.add_string_attribute('date', '[n/a]')     
    try: file.add_string_attribute('album',info.album)
    except: file.add_string_attribute('album', '[n/a]')
   except:
    file.add_string_attribute('length','error')
    file.add_string_attribute('pixeldimensions','error')
    file.add_string_attribute('bitrate','error')
    file.add_string_attribute('samplerate','error')
    file.add_string_attribute('title','error')
    file.add_string_attribute('artist','error')
    file.add_string_attribute('genre','error')
    file.add_string_attribute('track','error')
    file.add_string_attribute('date','error')
    file.add_string_attribute('album','error')
  # pdf handling
  if file.is_mime_type('application/pdf'):
   try:
    f = open(filename, "rb")
    pdf = PdfFileReader(f)
    try: file.add_string_attribute('title', pdf.getDocumentInfo().title)
    except: file.add_string_attribute('title', "[n/a]")
    try: file.add_string_attribute('artist', pdf.getDocumentInfo().author)
    except: file.add_string_attribute('artist', "[n/a]")
    f.close()
   except:
    file.add_string_attribute('title', "[no info]")
    file.add_string_attribute('artist', "[no info]")
     
  self.get_columns()


fuente: http://pastebin.com/WxspTtvL