Modern IPhones store images in HEIC files. How to convert them to JPG?

Install the heif-convert utility:

sudo apt install libheif-examples

Then run:

for f in *.HEIC; do heif-convert -q 100 $f ${f/.HEIC/.jpg}; done
Tags:
Let's say you decided to leave LiveJournal and to migrate to Dreamwidth. You do a full import of your journal to DW and everything looks fine and dandy, but there is one problem: if your LJ posts linked to each other, the import process would not adjust such links, and they still would point to livejournal.com. Clearly unacceptable! I wrote a quick and dirty script to fix that. Details below.

1) Get the ljdump.py script, put it in a directory.

2) In the same directory create a config file, ljdump.config:
<xml>
  <server>https://www.dreamwidth.org</server>
  <username>bluedrag</username>
  <password>password</password>
  <journal>bluedrag</journal>
</xml>
(substitute bluedrag with your own journal name, and password with your password).

3) Still in the same directory, run ljdump.py . It will create a subdirectory with the name of your journal and a full backup of all entries and comments. My script relies on the presence of that backup and the config file (ljdump.config).

4) Save my script to a file (fix_links.py) and run it in the same directory. It will go over your entries (but not comments) and will try to change all links to your livejournal posts (and tags) to the corresponding Dreamwidth links. It will ask before writing every entry back (but if you feel especially bold you can comment out the raw_input line).

Disclaimers: No warranties, and only tested on my journal. But it worked, and I feel great about the result.

Hasta la vista, LJ!

The script (big chunks borrowed from ljdump):

Read more... )
Tags:
If your camera clock was 59 minutes ahead:

exiftool -AllDates-=0:59 <files>
Tags:
If you are using Firefox in Linux (like I do), and configured YouTube to use HTML5, do the following to allow it to use resolution higher than 720p:

Go to about:config and make sure that media.mediasource.enabled and media.mediasource.webm.enabled is set to True.
Tags:

exif

Feb. 18th, 2015 13:28
bluedrag: (Default)
When I get a developed and scanned roll of film in the lab, the first thing to do is to try to remember when each frame was shot and then modify the files to embed as much info as possible, like this:

exiftool -overwrite_original -all= -Comment='Roll #1 (Kodak Tri-X 400); January-February 2015' -ISO=400 -Make=Minolta -Model='Minolta SRT 202' -FocalLength='135 mm' -Lens='Minolta MC Rokkor-PF 135mm f/2.8' -DateTimeOriginal='2015:02:02 00:00:00' -FNumber=2.8 -ExposureTime=1/250 80700033.jpg

(unfortunately, there are no EXIF tags for the type of film used, as far as I can tell).

I define environment variables for different lenses to make the command line shorter and more consistent:


export MINOLTA_28="-Make=Minolta -Model='Minolta SRT 202' -FocalLength='28 mm' -Lens='Minolta MD W.Rokkor-X 28mm f/2.8'"
export MINOLTA_50="-Make=Minolta -Model='Minolta SRT 202' -FocalLength='50 mm' -Lens='Minolta MD Rokkor-X 50mm f/1.4'"
export MINOLTA_135="-Make=Minolta -Model='Minolta SRT 202' -FocalLength='135 mm' -Lens='Minolta MC Rokkor-PF 135mm f/2.8'"
export MINOLTA_200="-Make=Minolta -Model='Minolta SRT 202' -FocalLength='200 mm' -Lens='Minolta MC Rokkor-PF 200mm f/3.5'"
Tags:

# figure out how the new drives are called:
lsscsi -s
# or
sudo lshw -C disk

# let's say it's /dev/sdb and /dev/sdc
# create partitions as needed
sudo fdisk /dev/sdb
sudo fdisk /dev/sdc

# create the RAID (in this case --level=1 => RAID1)
sudo mdadm --create /dev/md0 --level=1 --raid-devices=2 /dev/sdb1 /dev/sdc1 --verbose

# check on its status
sudo mdadm --detail /dev/md0
watch -d cat /proc/mdstat

# format
sudo mkfs.ext4 /dev/md0
# optional -- configure to use 99% of capacity
sudo tune2fs -m 1 /dev/md0

# define mount point: add the following line to /etc/fstab:
# /dev/md0 /mnt/raid ext4 defaults 1 2
sudo mount -a

# finally, configure the email notifications
# assuming you are running postfix, add a line to /etc/aliases:
# root: your@email
newaliases
# test:
sudo mdadm --monitor --scan --test --oneshot
Tags:
How to create a VirtualBox VM on an Ubuntu server from scratch.

apt-get upgrade virtualbox
VBoxManage createvm --name foo --ostype Ubuntu_64 --register

# configure it to use bridge networking
VBoxManage modifyvm foo --memory 2048 --cpus 2 --pae on --acpi on --hpet on --ioapic on --hwvirtex on --vtxvpid on --accelerate3d off --audio none --chipset ich9 --nic1 bridged --bridgeadapter1 eth0 --vrde on --vrdeport 5555 --clipboard bidirectional --vrdeaddress <server ip addr>

# create and attach a 10G virtual disk
VBoxManage createhd --filename VirtualBox\ VMs/storage/bar.vdi --size 10240
VBoxManage storagectl foo --name foo --add sata --controller IntelAHCI --bootable on
VBoxManage storageattach foo --storagectl foo --port 0 --device 0 --type hdd --medium ~/VirtualBox\ VMs/storage/bar.vdi

# configure to boot from the install image
VBoxManage storagectl foo --name dvd --add ide --bootable on
VBoxManage storageattach foo --storagectl dvd --port 0 --device 0 --medium /tmp/ubuntu-16.04.4-server-amd64.iso --type dvddrive
VBoxManage modifyvm foo --boot1 dvd

# start
VBoxHeadless -s foo

# now go to any computer, vnc into the new virtual machine and finish the installation:
# vnc <server ip addr>:5555

# stop the VM and diconnect the DVD image
VBoxManage controlvm foo poweroff
VBoxManage storageattach foo --storagectl dvd --port 0 --device 0 --medium none
VBoxManage modifyvm foo --boot1 disk

# start it again, vnc in, configure the ssh access and power off
# from now on, always start with vnc disabled, and use ssh to log in:
nohup VBoxHeadless -s foo --vrde off&
Tags:
In Ubuntu:

sudo pip install livestreamer
sudo apt-get install rtmpdump
sudo apt-get install python-dev
sudo apt-get install libffi-dev
sudo apt-get install librtmp-dev
sudo pip install cffi
sudo pip install python-librtmp

And then:

livestreamer ustream.tv/nasahdtv best
Tags:
How to transcode an MTS file (AVCHD, used by some cameras) to something more easily usable:

ffmpeg -deinterlace -i input-file.MTS -acodec copy -vcodec huffyuv output-file.avi
Tags:
LAST_FRAME=`ffprobe -show_streams xxx.mp4 2>/dev/null|fgrep nb_frames|head -1|perl -ne '/(\d+)/; print $1-1'`
ffmpeg -i xxx.mp4 -vf "select='eq(n,$LAST_FRAME)'" -vframes 1 last_frame.png
Tags:

PDF

Nov. 29th, 2013 20:48
bluedrag: (Default)
Как в линуксе вырезать из PDF страницы с mmm по nnn:

pdftk A=input.pdf cat Ammm-nnn output output.pdf


To assemble a pdf out of multiple images:

convert foo1.jpg foo2.jpg foo.pdf
Tags:
genisoimage -r -J -o image.iso /directory
wodim --speed 4 --eject -v -data image.iso
Tags:
Всё никак не мог найти любимую мною букву «Ё» на маковской клавиатуре.

Поскольку жить без неё категорически невозможно, пришлось заисследовать вопрос. Заодно обнаружилось несколько других полезных кнопок.

Итак, русская раскладка:
ё — \ (кнопка справа от твёрдого знака)
тире — Alt-Shift--
« — Alt-Shift-+
» — Alt-+

На английской раскладке самая, наверное, полезная возможность — ставить ÿмляуты. Для этого надо сначала нажать Alt-u, а потом соответствующую кнопочку.

Для полноты картины изучил ещё и ситуацию в линуксе. Прежде всего надо пойти в конфигурацию клавиатуры и настроить там себе «Compose Key» — например, правый Alt или Ctrl. После чего можно нажимать эту кнопку, а затем некую последовательность кнопок, которая преобразуется в один символ.

Например:
<< преобразуется в левую кавычку «,
>> — в правую »,
--- (три минуса) — в тире,
" кавычка и английская гласная буква — в эту букву с умляутом.

Полный списочек находится в файле /usr/share/X11/locale/en_US.UTF-8/Compose

Вынужден отметить, что тире и кавычки на Маке нажимать проще.
Tags:
Если вас попутал бес, и вы отформатировали флэшку с ценными фотографиями, восстановить их можно при помощи программы photorec (в убунту: "apt-get install testdisk").

Ну, а потом сдаваться врачам, конечно.
Tags:

August 2025

S M T W T F S
     12
3456789
1011121314 1516
17181920212223
24252627282930
31      

Expand Cut Tags

No cut tags

Style Credit