Roland's homepage

My random knot in the Web

Articles tagged with "python"

  1. Python number conversions

    Sometimes one has to convert numbers from and to different formats. Below are some examples in Python that I picked up over time. What you see are excerpts of IPython sessions.

    To and from hexadecimal (base 16):

    In [1]: hex(100)
    Out[1]: '0x64'
    
    In [2]: int(0xa7)
    Out[2 ...
  2. vid2mkv

    My digital camera can also produce movies, like most camera's these days. It saves them in AVI format, with relatively poor mjpeg compression and uncompressed sound.

    So I wrote this python script to convert these AVI files to Theora / Vorbis streams in a matroška container. It takes the AVI ...

  3. vid2mp4

    Videos with H.264 video and AAC sound im MP4 containers seem to strike a very good size performance balance. So I modified a copy of vid2mkv to use ffmpeg to create this kind of files instead.

    To speed up the processing of multiple files, this script runs the conversions ...

  4. Making my first EPUB

    Now that I got an EPUB reader, I started looking for a way to make EPUB documents.

    In principle, an EPUB file is a zipfile with a certain layout, as can be seen on the wikipedia page linked above.

    The actual contents are just XHTML, while the metadata files are ...

  5. Filtering a sound recording

    Recently I was listening to an MP3 file of a talk about no-till gardening when I noticed that there was a noticable buzz in the sound. I figured I would try my hand at sound filtering with Python as a learning experience.

    The Python standard library doesn't have a ...

  6. foto4lb

    Update: The script now allows you to set the target width of the
    pictures using the -w command-line argument. The script is now compatible with both python2 and python3.

    Photos from modern digital cameras are generally so large these days that you have to shrink them to use them in ...

  7. make-mp3

    Update: This script is now compatible with both python 2 and python3.

    After writing the make-flac python script, I adapted a copy to use LAME to generate variable bitrate MP3 files instead.

    source:make-mp3.py
    GPG signature:
    -----BEGIN PGP SIGNATURE-----
    Version: GnuPG v2.0.22 (FreeBSD)

    iQIcBAABAgAGBQJTEzgKAAoJEED21dyjijPgkgwP/iza9lYbFpKhL1Uwqm+OneMx
    W01A2z2 ...
  8. gitdates

    Update: This script should now work with both python2 and python3.

    In answer to this question on stackechange, I wrote gitdates.py. If it is called from a directory that is under git resivion control, it lists all the files there with the short hashtag and the date from when ...

  9. dicom2png

    This simple script uses ImageMagick to convert DICOM images from a Philips digital X-ray machine to PNG format. It crops the images from 2048x2048 pixels to 1574x2048 pixels, the actual size of the detector.

    To speed up the processing of multiple pictures, this script runs the conversions in parallel on ...

  10. git-check-all

    Update: This script should now be compatible with both python2 and python3.

    This scripts looks for all directories in the users' home directory that are managed by the git revision control system (i.e. that have a .git subdirectory).

    For each of those directories it checks wether there are uncommitted ...


Page 1 / 3 »