Skip to content

Instantly share code, notes, and snippets.

@andriika
andriika / dot_env.py
Created January 23, 2024 01:16
.env.yaml
import logging
import os
import fsspec
import yaml
from fsspec import AbstractFileSystem
log = logging.getLogger(__name__)

I

One morning, as Gregor Samsa was waking up from anxious dreams, he discovered that in his bed he had been changed into a monstrous verminous bug. He lay on his armor-hard back and saw, as he lifted his head up a little, his brown, arched abdomen divided up into rigid bow-like sections. His blanket perched high on this belly could hardly stay in place; it seemed about to slide off completely. His numerous legs, pitifully thin in comparison to the rest of his circumference, flickered helplessly before his eyes.

“What’s happened to me?” he thought. It was no dream. His room, a proper room for a human being, only somewhat too small, lay quietly between the four well-known. walls. Above the table, on which an unpacked collection of sample cloth goods was spread out—Samsa was a traveling salesman—hung the picture which he had cut out of an illustrated magazine a little while ago and set in a pretty gilt frame. It was a picture of a woman with a fur hat and a fur boa. She sat erect, lifting up in the direction

@andriika
andriika / > calcite get started.md
Last active April 19, 2024 08:25
Apache Calcite get started example. Enables SQL over in-memory json objects stored in java.util.Map.

Apache Calcite get started example. Enables SQL over in-memory json objects stored in java.util.Map.

<dependency>
    <groupId>org.apache.calcite</groupId>
    <artifactId>calcite-core</artifactId>
    <version>1.23.0</version>
</dependency>
@andriika
andriika / > systemd cheat sheet.md
Last active December 31, 2023 20:17
systemd cheat sheet

systemd Cheat Sheet

Add/Edit a Unit (.service)

# add new .service file
cp app.service /etc/systemd/system/

# or edit existing
systemctl edit --full app.service
@andriika
andriika / bash and win scripts.md
Last active June 19, 2018 04:12
collection of common scripting problems and its solutions for both unix bash and windows cmd (batch) platforms

if file not exists

bash:

if [ ! -f .env ]; then
    echo "ERR: .env file not found. Please create one, details: https://devcenter.heroku.com/articles/heroku-local#set-up-your-local-environment-variables"
    exit 1
fi

win:

@andriika
andriika / NioSelectorServer.java
Last active June 19, 2018 03:50
single-threaded server based on Java NIO selector
package acme;
import java.io.IOException;
import java.net.InetSocketAddress;
import java.nio.ByteBuffer;
import java.nio.channels.SelectionKey;
import java.nio.channels.Selector;
import java.nio.channels.ServerSocketChannel;
import java.nio.channels.SocketChannel;
import java.util.Iterator;
@andriika
andriika / mpeg-dash live stream.md
Last active November 27, 2024 13:17
live video streaming, html5, mpeg-dash, ffmpeg

Live streaming with HTML5

This document contains collected notes regarding html5 live streaming approaches. I'm trying to understand how to build a system that enables streaming of live video to HTML5 clients. Following content is mainly centered around MPEG-DASH - modern way of dealing with given needs.

Approach 1

To prepare movie.avi from MPEG-DASH streaming we will execute following ffmpeg commands:

> ffmpeg -y -i movie.avi -an -c:v libx264 -x264opts 'keyint=24:min-keyint=24:no-scenecut' -b:v 1500k -maxrate 1500k -bufsize 3000k -vf "scale=-1:720" movie-720.mp4
> ffmpeg -y -i movie.avi -an -c:v libx264 -x264opts 'keyint=24:min-keyint=24:no-scenecut' -b:v 800k -maxrate 800k -bufsize 1600k -vf "scale=-1:540" movie-540.mp4
&gt; ffmpeg -y -i movie.avi -an -c:v libx264 -x264opts 'keyint=24:min-keyint=24:no-scenecut' -b:v 400k -maxrate 400k -bufsize 800k -vf "scale=-1:360" movie-360.mp4