Skip to content

Instantly share code, notes, and snippets.

@0x0all
0x0all / xorg.conf
Last active December 9, 2019 12:31
/etc/X11/xorg.conf
# Ctrl+Alt+F1
# sudo systemctl stop lightdm.service
# chmod 777 NVIDIA-Linux-x86_64-375.20.run
# sudo sh NVIDIA-Linux-x86_64-375.20.run
# ver 3.0
# Ctrl+Alt+F1
# sudo dpkg --add-architecture i386
# sudo apt update
# sudo apt install build-essential libc6:i386
@0x0all
0x0all / mp4 and other
Created October 10, 2017 08:23
mp4 and other
# https://devhints.io/ffmpeg
# Ringtone conversion using ffmpeg
ffmpeg -i foo.mp3 -ac 1 -ab 128000 -f mp4 -acodec libfaac -y target.m4r
# no audio
ffmpeg -i input.mov -vcodec h264 -an -strict -2 output.mp4
ffmpeg -i input.mov -vcodec libvpx -an output.webm
# https://devhints.io/animated_gif
mkdir -p gif
mplayer -ao null -vo gif89a:outdir=gif $INPUT
mogrify -format gif *.png
gifsicle --colors=256 --delay=4 --loopcount=0 --dither -O3 gif/*.gif > ${INPUT%.*}.gif
rm -rf gif
# You’ll need mplayer, imagemagick and gifsicle. This converts frames to .png, then turns them into an animated gif.
@0x0all
0x0all / damerauLevenshteinDistance.cpp
Created July 12, 2017 19:47
damerauLevenshteinDistance
// https://www.codeatcpp.com/2011/04/autocomplete.html
int damerauLevenshteinDistance( const std::vector<char>& a, const std::vector<char>& b )
{
const int a_size = static_cast<int>( a.size() );
const int b_size = static_cast<int>( b.size() );
const int INF = a_size + b_size;
std::vector<std::vector<int> > H( a.size()+2, std::vector<int>( b.size()+2 ) );
H[0][0] = INF;
for ( int i = 0; i <= a_size; ++i ) { H[i+1][1] = i; H[i+1][0] = INF; }
@0x0all
0x0all / docker concole
Last active November 13, 2017 20:58
docker
docker run --name pgsql-test -e POSTGRES_PASSWORD=password -d -p 6000:5432 postgress
docker ps
docker stop pgsql-test
----
// Запустить из докера компиляцию
// https://habrahabr.ru/post/342218/
docker run --rm -it -v ~/go:/go -w /go/src/gifty golang:1.9.1 \
go build -o gifty_linux -v *.go
@0x0all
0x0all / webm2mp3.sh
Created May 28, 2017 11:35
convert webm to mp3
#!/bin/bash
for i in *.webm; do
ffmpeg -i "$i" -vn -ab 128k -ar 44100 -y "`basename "$i" .webm`.mp3";
done
@0x0all
0x0all / mp42mp3.sh
Created May 28, 2017 11:03
bash convert mp4 to mp3
#!/bin/bash
for i in *.mp4; do
ffmpeg -i "$i" -vn -acodec libmp3lame -ac 2 -qscale:a 4 -ar 48000 "`basename "$i" .mp4`.mp3"
done
put =expand('%:p')
@0x0all
0x0all / mp3.sh
Last active October 18, 2023 02:55
mp3
youtube-dl --extract-audio --audio-format mp3 --prefer-ffmpeg URL
@0x0all
0x0all / ogg2mp3.sh
Created January 29, 2017 20:57
ogg2mp3
for i in *.ogg; do ffmpeg -i "$i" -f mp3 "${i%.*}.mp3"; done