Skip to content

Instantly share code, notes, and snippets.

@msurov
msurov / refs.bib
Created April 7, 2026 15:30
References for scientific papers
@article{Yakubovich1986,
author = {Yakubovich, V. A.},
title = {A linear-quadratic optimization problem and the frequency theorem for nonperiodic systems. I},
journal = {Siberian Mathematical Journal},
volume = {27},
number = {4},
pages = {614--630},
year = {1986},
doi = {10.1007/BF00969175}
}
@msurov
msurov / compress_video.sh
Created January 8, 2025 16:36
bash script that aims to compress video files in current folder
#!/bin/bash
TMPDIR="/tmp"
TMPNAME="$TMPDIR/out.mp4"
function getsize {
echo $(stat -c%s "$1")
}
function compress {
@msurov
msurov / butterfly_parameters.json
Last active February 16, 2025 17:44
Parameters of the Butterfly Robot
{
"plates_inertia": 0.89e-3,
"plates_distance": 0.027,
"ball_radius": 0.017,
"max_torque": 0.15,
"ball_inertia": 5.8e-7,
"ball_mass": 3.0e-3,
"gravity_acceleration": 9.81,
"friction_coefficient": 0.60,
"plates_shape": [
@msurov
msurov / basic_units.py
Created February 23, 2024 11:19
Plot with radians from the basic_units mockup example package. This example shows how the unit class can determine the tick locating, formatting and axis labeling.
"""
===========
Basic Units
===========
"""
import math
from packaging.version import parse as parse_version
{
"plates_inertia": 0.89e-3,
"plates_distance": 0.02700000,
"ball_radius": 0.01700000,
"max_torque": 0.15,
"ball_inertia": 5.8e-7,
"ball_mass": 3e-3,
"gravity_acceleration": 9.81,
"friction_coefficient": 0.4,
"plates_shape": [
@msurov
msurov / cart-pendulum-animation.ipynb
Created August 1, 2023 09:31
cart-pendulum-animation.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
import numpy as np
from functools import reduce
def quat_make_continuous(q):
R'''
Brief:
------
The function makes a trajectory `q` continuous
import casadi as ca
class MyFun(ca.Callback):
def __init__(self, coefs):
ca.Callback.__init__(self)
self.coefs = coefs
self.construct('MyFun')
def has_jacobian(self):
return True
#include <iostream>
#include <stdio.h>
#include <png.h>
int read_png_file(char const* filename, uint8_t*& pimg, int& width, int& stridex, int& height)
{
FILE *fp = nullptr;
png_structp png = nullptr;
png_infop info = nullptr;
@msurov
msurov / quat.py
Last active September 20, 2022 22:19
NumPy quaternion support
import numpy as np
def quat_make_continuous(q):
R'''
Brief:
------
The function makes a trajectory `q` continuous
Detailed: