Skip to content

Instantly share code, notes, and snippets.

@vi
vi / png2yuva
Created Sep 13, 2019
Convert RGBA pictures to bigger grayscale picure showing colour planes and back using FFMpeg
View png2yuva
#!/bin/bash
S=$(identify "$1" | cut -d' ' -f 3-3)
IFS=x SS=($S)
W=${SS[0]}
H=${SS[1]}
ffmpeg -v warning -i "$1" -pix_fmt yuva444p -f rawvideo - | ffmpeg -v warning -pix_fmt gray -s ${W}x$((H*4)) -f rawvideo -i - -y "$2"
@vi
vi / mvimg_mpv
Created Aug 11, 2019
Shell script to play Google Motion Photos with mpv from command line
View mvimg_mpv
#!/bin/bash
if [[ -z "$1" || "$1" == --help || "$1" == "-?" ]]; then
echo "Usage: mvimg_play MVIMG_20190806_183324.jpg [other files]"
echo "Plays Google's Motion Photo using mpv. Depends on exiftool, mktemp, bash and mpv."
exit 0
fi
FOUND=0
ARGS=()
@vi
vi / split_by_silence_kf.sh
Last active Jul 20, 2020
Video-enhanced split_by_silence.sh script.
View split_by_silence_kf.sh
#!/bin/bash
IN=$1
OUT=$2
true ${SD_PARAMS:="-55dB:d=0.3"};
true ${MIN_FRAGMENT_DURATION:="20"};
export MIN_FRAGMENT_DURATION
if [ -z "$OUT" ]; then
@vi
vi / dnsmanageweb.rs
Last active Apr 18, 2019
Simple web portal to update dynamic DNS records
View dnsmanageweb.rs
#!/usr/bin/env run-cargo-script
//! ```cargo
//! [package]
//! name = "dnsmanageweb"
//! version = "0.1.0"
//! authors = ["Vitaly _Vi Shukela <vi0oss@gmail.com>"]
//! edition = "2018"
//!
//! [dependencies]
//! rouille = {version="3.0.0", default-features=false}
@vi
vi / hyper_hack.rs
Created Mar 24, 2019
Dump of hacky experimentation with Hyper. Not suggesting to write code like this
View hyper_hack.rs
// Trying to imiate `rust-websocket`-like interface with hyper 0.12
#![allow(unused)]
#![deny(unused_must_use)]
use tokio::prelude::*;
use tokio::net::tcp::{TcpListener,TcpStream};
use std::net::SocketAddr;
use hyper::server::conn;
use hyper::service::Service;
@vi
vi / split_by_silence.sh
Last active Aug 8, 2020
Using FFmpeg to split multimedia file into parts based on audio volume level
View split_by_silence.sh
#!/bin/bash
IN=$1
OUT=$2
true ${SD_PARAMS:="-55dB:d=0.3"};
true ${MIN_FRAGMENT_DURATION:="20"};
export MIN_FRAGMENT_DURATION
if [ -z "$OUT" ]; then
@vi
vi / hyperstdioclient.crs
Last active Jan 12, 2019
Rust Hyper low-level client demo - make request to stdout, read reply from stdin; also similar server demo
View hyperstdioclient.crs
#!/usr/bin/env run-cargo-script
//! ```cargo
//! [dependencies]
//! hyper = { version = "0.12.20", default-features = false }
//! tokio-stdin-stdout = "0.1.5"
//! readwrite = {version="0.1.1", features=["tokio"]}
//! futures = "0.1.25"
//! tokio = "0.1.14"
//! ```
@vi
vi / tcpclose.crs
Created Aug 2, 2018
Rust Tokio fast TCP socket close handling
View tcpclose.crs
#!/usr/bin/env run-cargo-script
//! ```cargo
//! [dependencies]
//! tokio = "=0.1.7"
//! tokio-codec = "*"
//! tokio-io = "=0.1.7"
//! futures-cpupool = "*"
//! mio = "*"
//!
//! [replace]
@vi
vi / playground.rs
Created Aug 1, 2018 — forked from rust-play/playground.rs
Code shared from the Rust Playground
View playground.rs
#!/usr/bin/env run-cargo-script
// cargo-deps: tokio, tokio-codec, tokio-io, futures-cpupool
extern crate tokio;
extern crate tokio_codec;
extern crate tokio_io;
extern crate futures_cpupool;
use tokio_codec::{Decoder, LinesCodec};
@vi
vi / log
Created Jan 30, 2018
Another CLBlast test
View log
* Options given/available:
-platform 0 [=default]
-device 0 [=default]
--- OpenCL device naming:
* Device type GPU
* Device name Intel(R) HD Graphics IvyBridge M GT2
* Platform vendor Intel
You can’t perform that action at this time.