Skip to content

Instantly share code, notes, and snippets.

View eduard-sukharev's full-sized avatar

Eduard Sukharev eduard-sukharev

  • VK Play
  • Russia, Saint-Petersburg
View GitHub Profile
@eduard-sukharev
eduard-sukharev / gravatar.pl
Created August 10, 2017 11:03
Visualize git project history with Gource
#!/usr/bin/perl
#fetch Gravatars
use strict;
use warnings;
use LWP::Simple;
use Digest::MD5 qw(md5_hex);
my $size = 90;
@eduard-sukharev
eduard-sukharev / video_to_gif.sh
Created October 30, 2018 10:31
Convert video to gif
#!/bin/sh
file_in=${1:-"input.mp4"}
file_out=${2:-"output.gif"}
fps=${3:-20}
width=${4:-400}
ffmpeg -y -i $file_in -vf fps=$fps,scale=$width:-1:flags=lanczos,palettegen palette.png
ffmpeg -y -i $file_in -i palette.png -filter_complex "fps=$fps,scale=$width:-1:flags=lanczos[x];[x][1:v]paletteuse" $file_out
@eduard-sukharev
eduard-sukharev / composer.sh
Created March 22, 2019 19:36
Composer shim from docker container
#!/usr/bin/env bash
COMPOSER_IMAGE=composer
if [ -t 1 ] ; then
mkdir -p "$HOME/.cache/composer"
docker run \
-it \
--rm \
-u "$(id -u):$(id -g)" \
@eduard-sukharev
eduard-sukharev / run-dev.sh
Last active July 30, 2021 12:22
Sample script to up a local dev environment with docker containers
#!/usr/bin/env bash
HELPER_CONTAINERS=false
PROJECT=my-app
while getopts "ha" option
do
case "${option}" in
a) HELPER_CONTAINERS=true;;
h) echo "Helper script to run app in local docker environment."
@eduard-sukharev
eduard-sukharev / mount.sh
Last active December 25, 2021 20:51
Sample workflow to mount UBI files to local directory
sudo modprobe -r ubi
sudo modprobe -r mtdram
sudo modprobe nandsim first_id_byte=0x20 second_id_byte=0xaa third_id_byte=0x00 fourth_id_byte=0x15 total_size=40000
cat /proc/mtd
# dev: size erasesize name
# mtd0: 10000000 00020000 "NAND simulator partition 0"
sudo flash_erase /dev/mtd0 0 0
# Erasing 128 Kibyte @ ffe0000 -- 100 % complete
sudo ubiformat /dev/mtd0 -f rootfs.ubi -e 0 -O 2048
# ubiformat: mtd0 (nand), size 268435456 bytes (256.0 MiB), 2048 eraseblocks of 131072 bytes (128.0 KiB), min. I/O size 2048 bytes
@eduard-sukharev
eduard-sukharev / init
Created January 7, 2022 18:54
centos init script
#!/bin/sh
#
# example start stop daemon for CentOS (sysvinit)
#
# chkconfig: - 64 36
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 2 3 4 6
# Required-Start:
# description: example start stop daemon for CentOS
# processname: python
@eduard-sukharev
eduard-sukharev / ARMonQEMUforDebianUbuntu.md
Last active January 10, 2022 19:40 — forked from luk6xff/ARMonQEMUforDebianUbuntu.md
Emulating ARM with QEMU on Debian/Ubuntu

Running ARM Debian/Ubuntu on QEMU

If the below is too much, you can try Ubuntu-ARMv7-Qemu but note it contains non-free blobs.

Architectures cheatsheet:

  • armel - emulated floating point (ARMv6 and older)
  • armhf - hardware floating point (ARMv7 and newer)
  • arm64 (aarch64, aarm64) - ARM with 64bit support (mainly ARMv8 and newer)
@eduard-sukharev
eduard-sukharev / cue_to_flac.py
Last active May 1, 2024 21:11 — forked from Theldus/cue_to_flac.py
CUE splitter using ffmpeg (to flac)
import os
import subprocess
import sys
from itertools import chain
import argparse
parser = argparse.ArgumentParser(description="Split audio file by .cue metadata.")
parser.add_argument(
"cue-files",
help="CUE file to be parsed. Multiple files can be passed. If no files provided, reads from stdin",
@eduard-sukharev
eduard-sukharev / .bashrc
Last active May 24, 2023 17:24
PS1 with 256 Colors
# refer to https://robotmoon.com/bash-prompt-generator/ for configuration help and examples
# use https://github.com/seedform/Bash-Color-Palette for 256 colors reference palette
COLOR_GREEN="\001\033[38;5;35m\002"
COLOR_BLUE="\001\033[38;5;33m\002"
COLOR_BLUE_PALE="\001\033[38;5;25m\002"
COLOR_RED="\001\033[38;5;296m\002"
COLOR_ORANGE="\001\033[38;5;208m\002"
COLOR_YELOW="\001\033[38;5;220m\002"