Skip to content

Instantly share code, notes, and snippets.

View eSlider's full-sized avatar

Andrey Oblivantsev eSlider

View GitHub Profile
@eSlider
eSlider / restart-bluetooth.sh
Created November 11, 2022 09:35
Restart bluetooth to get HQ sound over pipewire
#!/bin/bash
# Restart bluetooth on to get HQ devices runs over APTX on pipewire
# Supported devices: IdeaPad 5 Pro 16ACH6 with AX210
# Solutions: https://bbs.archlinux.org/viewtopic.php?id=17135
systemctl stop bluetooth
hciconfig hci0 down
rmmod btusb
modprobe btusb
hciconfig hci0 up
@eSlider
eSlider / semiver.sh
Created July 14, 2021 15:30
semiver.sh
#!/bin/bash
# https://engineering.taboola.com/calculating-git-version/
# Maybe we would use https://gist.github.com/OleksandrKucherenko/9fb14f81a29b46886ccd63b774c5959f
# Depends on https://semver.org/spec/v2.0.0.html
branch=$(git rev-parse --abbrev-ref HEAD)
latest=$(git tag -l --merged master --sort='-*authordate' | head -n1)
semver_parts=(${latest//./ })
major=${semver_parts[0]}
minor=${semver_parts[1]}
@eSlider
eSlider / get-locaiton-translations-by-wiki-id.sh
Last active April 21, 2021 07:14
Get location translations by Wiki ID
#!/bin/sh
WikiID=$(test -z $1 && echo "Q2090" || echo $1)
curl -X GET "https://www.wikidata.org/w/api.php?action=wbgetentities&ids=${WikiID}&format=json" | jq ".entities[].labels | map( {(.language): .value} )"
@eSlider
eSlider / text2speech.sh
Last active October 20, 2023 09:15
Russian text to speech
#!/bin/bash
sudo add-apt-repository ppa:linvinus/rhvoice
sudo apt-get update
sudo apt-get install rhvoice rhvoice-russian rhvoice-english aplay
set -x
# Play russian speaker voices
for speeker in aleksandr irina elena anna
@eSlider
eSlider / Dockerfile
Created April 16, 2021 09:32
Build, make ready to run and dramatically shrink .net 5.0 lambda docker image size by using alpine
#FROM public.ecr.aws/lambda/dotnet:5.0
#
#WORKDIR /var/task
#
## This COPY command copies the .NET Lambda project's build artifacts from the host machine into the image.
## The source of the COPY should match where the .NET Lambda project publishes its build artifacts. If the Lambda function is being built
## with the AWS .NET Lambda Tooling, the `--docker-host-build-output-dir` switch controls where the .NET Lambda project
## will be built. The .NET Lambda project templates default to having `--docker-host-build-output-dir`
## set in the aws-lambda-tools-defaults.json file to "bin/Release/net5.0/linux-x64/publish".
##
package main
import (
"fmt"
"sort"
)
type Person struct {
Name string
Age int
@eSlider
eSlider / remove-duplicates.sh
Created May 2, 2020 15:10
Remote duplicates
#!/bin/bash
fdupes -rSdNI ./
@eSlider
eSlider / go-shell-script.go
Created February 27, 2020 13:19
Golang Shell Script
//usr/bin/env test -x $0 && (go build -o "${0}c" "$0" && "${0}c" $@; r=$?; rm -f "${0}c"; exit "$r"); exit "$?"
//
// The top "comment" defines shebang
// More over:
// * https://gist.github.com/posener/73ffd326d88483df6b1cb66e8ed1e0bd
// * https://getstream.io/blog/switched-python-go/
package main
import (
@eSlider
eSlider / Dockerfile
Last active December 22, 2019 14:57
Dramatically shrinking .net core 3.1 docker image publishing size
# Officia microsoft .NET SDK image
FROM mcr.microsoft.com/dotnet/core/sdk:latest AS api-build
# Set directory for build
WORKDIR /app
# Copy anything from where docker would be builded
COPY ./. ./
# Reice packages, Build and shrink as an standalone exutable file
@eSlider
eSlider / mbtiles2pbf.sh
Created September 24, 2019 13:53
Extract PBF tiles from mbtiles (SQLite)
#!/bin/sh
git clone https://github.com/mapbox/mbutil
cd mbutil
./mb-util --image_format=pbf *.mbtiles tiles
gzip -d -r -S .pbf *
find . -type f -exec mv '{}' '{}'.pbf \;