Skip to content

Instantly share code, notes, and snippets.

View pavel-perina's full-sized avatar

Pavel Peřina pavel-perina

View GitHub Profile
@pavel-perina
pavel-perina / 2023-08-14-photography-calculations.ipynb
Last active August 17, 2023 19:46
Night time photography calculations (sky coverage, star trail length)
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
/************************
* validationEngaged.js *
************************
*
* They're really on to us now! The validateLevel function
* has been activated to enforce constraints on what you can
* do. In this case, you're not allowed to remove any blocks.
*
* They're doing all they can to keep you here. But you
* can still outsmart them.
@pavel-perina
pavel-perina / time-saving.py
Created March 27, 2021 10:58
Daylight saving vs standard time
# matplotlib, pandas, suntime, ipykernel (vscode)
# https://www.nordtheme.com
# https://astral.readthedocs.io/en/latest/index.html
#%%
import datetime
from astral import sun, LocationInfo
import pandas as pd
import matplotlib.pyplot as plt
import matplotlib.dates as mdates
// -----------------------------------------------------------------------------------
/// @brief Difference between two angles in radians, difference is inside -PI..PI
/// @todo: verify sign
/// NOTE: same function in Collision\col_math.cpp
__inline double AngleDiffRad (double a, double b)
{
double r = fmod (b - a, M_PI+M_PI);
if (r < 0.0)
r += M_PI+M_PI;
if (r > M_PI)
@pavel-perina
pavel-perina / video_command_line.txt
Last active November 4, 2022 22:12
Video encoding (command line, batch files, ...)
d:\apps\mplayer\mencoder mf://out*.jpg -mf w=1024:h=896:fps=10:type=jpg -o out-lq.avi -nosound -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=3000
rem d:\apps\mplayer\mencoder mf://out*.jpg -mf w=1024:h=896:fps=10:type=jpg -o out.avi -nosound -ovc x264 -x264encopts subq=6:partitions=all:8x8dct:me=umh:frameref=5:bframes=3:b_pyramid=normal:weight_b
d:\old-d\apps\mplayer\mencoder mf://vid00*.png -mf w=1280:h=720:fps=30:type=png -o vid00.avi -nosound -ovc x264 -x264encopts subq=6:partitions=all:8x8dct:me=umh:frameref=5:bframes=3:b_pyramid=normal:weight_b
d:\old-d\apps\mplayer\mencoder mf://vid01*.png -mf w=1280:h=720:fps=30:type=png -o vid01.avi -nosound -ovc x264 -x264encopts subq=6:partitions=all:8x8dct:me=umh:frameref=5:bframes=3:b_pyramid=normal:weight_b
d:\apps\mplayer\mencoder mf://@tissue-list.txt -mf w=1920:h=1200:fps=30:type=png -o out.avi -nosound -ovc x264 -x264encopts subq=6:partitions=all:8x8dct:me=umh:frameref=5:bframes=3:b_pyramid=normal:weight_b
d:\apps\mplayer\mencoder mf://solder2-*.png -mf w=1280:h=
@pavel-perina
pavel-perina / resize.sh
Last active June 7, 2017 21:03
Subpixel image resizing using imagemagick convert
#!/bin/sh
convert ResizeTestImage.png -gamma 0.5 -filter Mitchell -resize 800x200! -morphology Convolve "3x1: 0.33, 0.34, 0.33" -channel Red -morphology Convolve "3x1: 0.0, 0.0, 1.0" -channel Green -morphology Convolve "3x1: 0.0, 1.0, 0.0" -channel Blue -morphology Convolve "3x1: 1, 0, 0" +channel -filter Point -resize 267x200! -gamma 2.0 -depth 8 ResizeTestSubpixel.png
@pavel-perina
pavel-perina / fixed_aspect_ratio_qlayout.h
Last active June 15, 2023 12:33
QLayout that keeps fixed aspect ratio of it's only widget.
/*
Copyright (c) 2017 Pavel Perina
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions: