Create a Windows 10 recovery disk on Linux

In this howto there are the steps to follow when a Windows 10 OS is not bootable anymore and you haven’t a recovery disk. This is a typical case after a new OS will be installed on Dual boot or boot partition was altered.

  1. Download Windows 10 iso:
    1. Download the official Windows 10 image
  2. Prepare USB to be bootable:
    1. Open GParted with
gparted /dev/DEVICE-TO-ERASE
  • Select the USB drive
  • Device > New partition table
  • Select GPT
  • Apply: this will delete any data on the USB
  • Create a new NTFS partition then Apply (do not use FAT32 since some files can be greater than 4GB)
  • Close GParted
  • Write files:
    1. Unplug and plug USB
    2. Copy all Windows files to the empty USB drive using 7zip with:
      7z x -y -o/media/user/path-to-USB/ Win10_1809Oct_Italian_x64.iso
    3. If something goes wrong during copy, you can mount the ISO image then rsync the source with the USB drive (the trailing slash is important):
  • cd path/to/usb/drive
    rsync -avzp /media/myuser/CCCOMA_X64FRE_IT-IT_DV91/ .
  • umount
  • Add boot flag
    1. Open GParted selecting the device just written
    2. Select the new partition then
    3. Select Partition > Manage flags
    4. Select boot flag (esp will be auto-selected)
    1. Use windows tools
      1. Follow this howto by MS to recover MBR, restore BCD or similar actions

    You can follow these steps to write on a USB a recovery ISO from windows the same way.

    10 steps to install LyX on Windows

    Here the steps to install LyX on Windows:

    1. Download MiKTeX to provide LaTeX (usually the 64bit version)
    2. Select the installation directory and remember the path
    3. Complete the installation procedure
    4. Download and install LyXWinInstaller
    5. Press Next until a dictionary list is presented: add dictionaries for your languages
    6. Before installing the MiKTeX will be shown:
    7. Click Install and proceed.
    8. You should get an Update popup for MiKTeX, check the connection settings and then proceed and click Next to update all packages
    9. After the update close the MiKTeX popup and wait to LyX installation to finish: it should take minutes, to see progress click “See details” so you can see it’s not hanged up but it’s simply fetching different templates you can use later.
    10. Select Launch LyX and start using LyX

    Now you can enjoy LyX for Windows to create PDF using LaTeX without having to deal with the usual formatting hassles of a WYSIWYG editor.

    If you’re a beginner or you want to jog your memory about LyX select Help > Tutorial.

    To export to PDF you can user File > Export and then select PDF LuaTeX or PDF XeTeX. In my case LuaTeX generate larger document than XeTeX but both are nicer than those generated by ps2pdf.

    Note: If you get some error by MiKTeX regarding SOMETHING.sty, close LyX and in the Windows application finder search MiKTeX Package Manager and run it as Admin. Then look for SOMETHING and install it. This will fix the issue!

    Python: MySQLdb on Windows virtualenv (w. figures)

    If you have a virtualenv on Windows and you want to add MySQLdb support via mysql-python, read this before spending hours of your life to figure why it doesn’t and it will never work.

    1) Install MySQL for Python selecting the same Python version of the virtualenv


    2) From site-packages directory above, copy the selected files:


    3) (optional) On PyCharm, look for virtualenv site-packages inside the path marked with the arrow:


    4) Open your virtualenv console ad do:

    import MySQLdb

    MySQL for Python is now installed on your virtualenv.

    About the same topic
    How to Install MySQLdb in PyCharm, Windows
    Linux: MySQLdb on virtualenv with –no-site-packages


    How to fix freezed Windows 7

    If your Windows system is slow and you’ve already tried to clean up the autostarts you may have other issues. To do a global check on your system you can follow these steps:

    1. Download Hiren’s Boot CD (list of software installed here)
    2. Extract the zip file in a new folder (the zip contains many files)
    3. Use the shipped CD creation tools BurnCDDC or use the excellent cdrtools Frontend going to CD image > Write image and choosing the Hiren’s.BootCD.x.x.iso file inside
    4. Restart the PC with the CD in and boot from disk: after the boot a screen will be presented, usually you have to press a key like F12 to choose a boot device or press a key like F2 to go to BIOS and choose the boot order putting the DVD first
    5. Choose Start Mini Windows XP and press Enter
    6. After boot, you’ll see an interface similar to Windows XP: on Desktop click on My Computer to view if all drives are listed. Take a look at the space left on devices
    7. Start > Programs > Check disk, insert the letter of the drive to check and then Enter
    8. (Optional) After the disk check, you can also use other disk tools from Desktop > HBCD Menu > Programs > Hard disk tools if needed. Be careful, some tools can be dangerous and you have to know what you’re doing
    9. Now that disk error are fixed, go to Desktop > HBCD Menu > Programs > Antivirus/Spyware and choose Avira or Malawarebytes’ Anti-Malaware
    10. Choose the units and the scan mode and then run the tool
    11. Repeat these steps with all tools you need in the Antivirus / Spyware section
    12. Go to Desktop > HBCD Menu > Programs > Cleaners > CCleaner or ATF Cleaner and clean temporary files and entries from your system. Warning: personal data like browser saved password could be lost, choose the cleaning options carefully
    13. On Desktop > HBCD Menu > Programs > Cleaners > MyUninstaller uninstall all application you don’t need
    14. Check the space left on the disks on Desktop > My Computer. If little space is left on the main drive use Desktop > HBCD Menu > Programs > Cleaners > Windirstat to find big files (about Windirstat)
    15. Now it’s time to look at the apps in autostart: go to Desktop > HBCD Menu > Programs > Startup tools > Autoruns: this is a Microsoft app that lists all application executed automatically. Look for suspicious entries and disable what you don’t need
    16. You can explore other tools on this bootable CD depending on your needs

    Tested with Hiren’s BootCD 15.2

    Screencapture to GIF: how to record desktop and save screencast as animated GIF

    This is a step-by-step howto to record your desktop and then save it as animated GIF using free software. The resulting file will be very small compared to video files, e.g. a 2 minutes long screencapture of a webpage browsing can be less than 1MB.


    • Windows
    • CamStudio
    • VirtualDub
    • Gimp
    • Gigabytes of free space in the destination drive for the intermediate video screencapture

    How to:

    1. Install CamStudio
    2. Install VirtualDub (if you have a 64bit OS install the 64 bit version)
    3. Prepare the window you have to screencapture
    4. Capture the video
      1. Open CamStudio
      2. Options > Video Options > Codec Intel IYUV (lossless) and then OK
      3. Select Region > Windows (or other as needed)
      4. Press the record button and select the Window to record
      5. Press stop to stop recording
      6. Select a destination directory and filename: make sure you’ve enough free space
    5. Convert to GIF
      1. Decompress VirtualDub and launch the Veedub64.exe (user interface) or equivalent
      2. File > Open video file and then select the previously generated file (step 4.6)
      3. Video > Frame rate > Frame rate conversion
      4. Select Convert to fps and specify a low value like 2 and then OK
      5. Video > Color Depth
      6. From Output format to compressor / display select 16 bit RGB (555) or greyscale (0-255): it will downsize the output GIF file
      7. File > Export > Animated GIF
      8. Select Play once, infinite loop or specify a loop number
      9. Save the resulting file
    6. Edit the GIF
      1. Launch GIMP
      2. Optional: Select Window > Single window mode to keep all tools in one window (useful for PhotoShop users)
      3. Open the generated GIF (step 5.9)
      4. Crop, rescale and alter the image as you like
      5. Optional: Image > Mode > Indexed to change colors reducing filesize
      6. File > Export as… > Animated GIF
      7. Check the “As animation” flag
      8. Export

    The GIF can now be published on forums, or any image hosting provider.

    Free disk space by finding big files

    Here you can find some useful application to look for big files on disk for Windows and Linux. These disk tools are all free software, and very useful to find big files on disk and free disk space.

    On Windows: WinDirStat

    • Download and install WinDirStat
    • Run WinDirStat on your disks (it will take time)
    • You’ll see a coloured map of file occupation by file type


    On Linux command line: ncdu

    • On Ubuntu / Debian
      • apt-get install ncdu
      • cd /dir/to/check
      • ncdu
    • On CentOS / Fedora / RedHat
      • yum install ncdu
      • cd /dir/to/check
      • ncdu


    ncdu screenshot by Official Website

    Press c to show the number of files / directories contained inside each directory, and C to sort them for number of items, pressing ? will show all available shortcuts.

    On Linux with window manager (recent OS)

    On a GNOME system (e.g. Ubuntu 20), the Disk Usage Analyzer is already installed, you can run with the command “baobab”. If not installed, you can:

    apt-get install baobab


    On Linux with window manager (legacy OS)

    • CentOS / Fedora / RedHat
      • yum install k4dirstat
    • On Ubuntu / Debian
      • apt-get install k4dirstat

    Again, you’ll see a coloured map of file occupation by file type.

    Official website



    Screenshot by

    Updated on 2020-04-26

    How to start programming in Python on Windows

    To develop in Django can be confusing for a new Python developer but using Windows to develop in Django can be a major obstacle too.

    How to choose the right IDE for Windows and how to find and install Python libraries? Below six fundamental resources to program with Python on Windows.

    Bitnami Django Stack

    For developer using Windows, Bitnami Django Stack is a life-saver. It raises you to the need of installing and configuring many libraries and simply create a Python / Django environment on your system. Even if you don’t want to use Django, it can be a great starting point to install Python and fundamental libraries you can extend via PyCharm.



    Screenshot: official website

    JetBrains’ PyCharm is the multiplatform IDE to develop in Python. You can forget about the indentation issue and focus on programming. The autocomplete dropdown, the Python console, the easy management of DVCS systems (Git, Mercurial), the easy access to Python packages repositories will make it the tools for Python programming, especially in Windows where there are few alternatives than Linux. On Windows, rely on the Bitnami Django Stack you’re using to load the right libraries.

    PyPI – Cheese Shop

    PyPI is the repository of Python packages. Since the PyPI is nearly unpronounceable, you can call it Cheese Shop. Python was named by Guido van Rossum after the British comedy group Monty Python and the Cheese Shop is this sketch:

    Contrary on the poor guy in the sketch, you will find all sort of cheese you need in the cheese shop.


    Pip is the definitive tool for installing Python packages from Cheese shop on your environment. pip install package-name and you’ll get the package ready and running. Even more interesting is the pip install -r requirements.txt feature. It will install all the packages listed in the requirements.txt text file usually shipped with a package having some dependencies.



    Screenshot: official website

    Django and PostgreSQL DBMS are a powerful couple. If you have to use a PostgreSQL database, the best interface you can use is PgAdmin.

    Django Packages

    Django Packages is the Hitchhiker guide to the cheese shop. You’ve to choose a REST framework but you don’t want to marry with a unreliable partner? You need a good photo gallery and you want to get the best django app to implement in your django application? Django packages will guide you to the best solution for your needs.


    Any feature has a comparison matrix, where all projects are listed in columns where these criterion, elaborated from Github, are contemplated:

    • Project status (production, beta, alpha)
    • Commit frequency in the repository
    • How many times the project was forked
    • Who work on the project
    • Link to online documentation
    • Features comparison

    If you’re coming from a CMS like Drupal here some tips to how to approach a Model-View-Controller like Django, starting from the Entity-Relationship model.

    Personal note: Back in the 1998 I start to develop application for the web using ASP and PHP and dependencies weren’t an issue since these languages are for the web. Developing in Python is more challenging and really more fun than programming in PHP. You have a powerful multipurpose language with a ton of libraries competing in a far larger arena than the web development. Not surprising, Google use this language extensively as of some popular web services like Pinterest and Instagram: these last two are using Django.

    Read also on the same topic: Django development on Virtualbox: step by step setup

    Windows 7: disable sound on screen lock

    I have to confess one of my sins. I use Windows 7. Stop. I know, I talk about open source a lot, I’m a proud linux user but yes, I have to use this OS, especially on work. What do you do for money, eh?

    I usually play some music while doing some coding. If you ever tried to use PHP as a real programming language, maybe if you’re here you know what I’m speaking of. You can’t without music, seriously.

    So you go to eat or to microwave something to eat during your PHP yoga practice. You lock the screen with WIN + L shortcut but the music keep playing in background, in the barely audible hearphones on your desk. I don’t like it, and manually disabling it every time is a waste of time.

    Well, I’ve just discovered this small utility for Windows named Mute on Lock. Just keep it on tray icon and this small application will mute audio on lock.

    If you run Windows 7, you have to search the application from the search box on start, 1) right click on 2) Properties 3) Compatibility 4) Windows XP (service pack 3 is fine).

    Close and restart program and try to lock screen with WIN + L or by the start button.

    Remember that when you unlock the screen, music will start to play again, so pay attention.

    See also:

    Reinstalling Windows keeping GNU/Linux partition safe

    Tested with:

    • Windows Vista
    • Ubuntu 9
    • (on the same disk, different partitions)

    Today I’ve to reinstall Windows. I’ve already an installation of GNU/Linux (Ubuntu) on the same disk. I have to worry? In the past, I had to say a big YES. And since I do a Windows reinstall every 2-3 years, this carry back something from previous times.

    (Please skip this paragraph.)

    When I was a little boy, the best processor I was dreaming was Pentium 133Mhz, PCs were assembled in my country and my days was filled with Duke Nukem 3d and Lucas Arts adventures, well in that days I had a freaking fear to lose all my precious savegames and BASIC experiments due to a disaster. I discovered a real MBR disaster several years later, with Mandrake and Windows 98.

    Well, now things are easier.

    1. Backup your files from Windows (Lucas Arts adventures savegames too…).
    2. Reinstall that crappy OS that you had to have to play some games to the partition that it deserves.
    3. After the operation Your Master Boot Record is gone, GRUB is gone. Linux, where are you??
    4. Download Super Grub2 Disk.
    5. Take an old CD-RW (that one with the photos of your sister kitten that she loves so much), erase it and burn the bootable iso on it.
    6. Now follow the instruction from the website. I’ve followed these steps:
    7. Select Detect any OS. On the next window, select your GNU/Linux distribution, identified by the kernel version (the more recent version is usually the right).
    8. Now that your distro is successfully running (i.e. Ubuntu), you have to rebuild the Grub bootloader, putting it on the MBR of the disk.
    9. Open a shell and type:
      sudo -i
      grub-install /dev/sda
      Where /dev/sda is the device for the disk where the two OS are. If you have doubt, use tools like gparted to inspect your disk searching for the right device identifier.
    10. After restart, Grub is running again! So Windows is reinstalled without even touching Ubuntu.

    If you’re also interested on changing grub boot sequence order, follow this howto.