dict.has_key() was removed in Python 3.x.
This sed regex could fix them all:
sed -r "s/([a-z,A-Z,0-9,.,_]*)\.has_key\('([^']*)'\)/'\2' in \1/g" \ -i `find -name "*.py"`
Enjoy.
dict.has_key() was removed in Python 3.x.
This sed regex could fix them all:
sed -r "s/([a-z,A-Z,0-9,.,_]*)\.has_key\('([^']*)'\)/'\2' in \1/g" \ -i `find -name "*.py"`
Enjoy.
This little script will help you to understand how to use xrandr to enable, disable and configure your second Display via bash:
#!/bin/bash FIRST="HDMI-0" SECOND="DVI-0" BASECMD="xrandr --auto --output $SECOND" MODE="--mode 1920x1080" DIRECTION="--right-of $FIRST" ROTATE="--rotate left" OFF="--off" function off() { $BASECMD $OFF } function on() { $BASECMD $MODE $DIRECTION $ROTATE } function usage() { echo "usage: $(basename $0) on|off" } case "$1" in on) on ;; off) off ;; *) usage ;; esac
Enjoy! 🙂
I always loved use tmp directory to manage my “temporary files”. First of all, which files can be considered as “temporary”, and what does temporary exactly means? Well.. In my opinion, we can address as temporary all those files used only during a single Session. Such as:
If you use the standard $HOME/Downloads
 (or the Desktop, or Home or whatever_you_use) directory to locate all those files, you already know which kind of mess will be there in few days, unless you do not spend part of your time to delete those files no longer used. Looking for a solution to this I figured out that set /tmp
directory (not really, but think about that) as my Download directory can be a good choice… It will be cleaned to each boot, so I can take no interest about files I download during a Session – and store only those I consider “important”, by moving to my “Downloads” (or “Documents”) directory. It can work, no? No. In fact that’s not all. I also love mount /tmp
in Ram in order to speed up a bit the system… And place my downloads in /tmp
can be dangerous for the system –  sometimes downloaded files can be bigger than we expect (try to think to a 20MB pdf). So, one of the best way (in my opinion) to have a clean “downloads” directory is create a local ~/tmp
directory and use it as the default download directory for my Desktop and in the following lines I will show you how set it up.
Let’s start with mount /tmp in Ram, edit your /etc/fstab
 appending the lines below:
# RAM Disks tmpfs /tmp tmpfs defaults 0 0
Next step, create a ~/tmp directory (or wherever you prefer) and set it as Downloads directory:
mkdir ~/tmp xdg-user-dirs-update --set DOWNLOAD ~/tmp
Now create a script able to clean the directory to each login. I choose a file named ~/.initrc (you can use it to launch other applications, like conky). Use your preferred editor and insert the following lines:
#!/bin/bash # Clean tmp dir: find $HOME/tmp -mindepth 1 -delete &
Save the file and link it into your “Startup Applications” (search it through Unity), I use the following:
That’s all. My simple way to have a clean Home directory.