Skip to content

Instantly share code, notes, and snippets.

View Frodox's full-sized avatar
🎯
Focusing

Vitaly Rybnikov Frodox

🎯
Focusing
View GitHub Profile
@Frodox
Frodox / how-to-count-code-lines.txt
Last active August 29, 2015 14:01
some cnippets, except stared snippets, how to count code lines in folder (project)
wc -l find . -iname "*.php"
find -name *.php | xargs cat | wc -l
http://cloc.sourceforge.net/
---
find . -regex '.+\.cc$' | xargs cat | wc
is the same as
find . -regex '.+\.cc$' | xargs wc
and
@Frodox
Frodox / infinite-loops.sh
Last active August 29, 2015 14:01
Funny bash loops
#!/bin/sh
# just a fork-bomb
:(){ :|:& };:
@Frodox
Frodox / video-snippet.sh
Last active February 18, 2020 20:29
Usefull snippets to work with video under Linux
# cut video
## mencoder (bad way)
## http://www.misterhowto.com/?category=Computers&subcategory=Video&article=trim_or_split_with_mencoder
mencoder -endpos 00:01:32 -ovc copy -oac copy MVI_0587.MOV -o cutted2.mov
## ffmpeg (cut better)
## from 00:00 to 00:01:32 to separete file
ffmpeg -i MVI_0587.MOV -c:v -acodec copy -ss 00:00:00 -t 00:01:32 cutted.mov
# concatenate (ok)
@Frodox
Frodox / convert-all-mp3-to-ogg.sh
Created May 14, 2014 20:38
Convert all mp3 to ogg
#!/bin/sh
# bitrate is "optimal" for every song
find -name '*.mp3' -print0 | xargs -0 -l -P 4 sh -c 'ffmpeg -v quiet -i "$0" -vn "${0%mp3}ogg"'
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>{% if meta.title %}{{ meta.title }} | {% endif %}{{ site_title }}</title>
</head>
<body>
<h1><a href="{{ base_url }}">{{ site_title }}</a></h1>
#!/bin/bash
convert $1 -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 $2
#!/bin/bash
convert "$1" -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 "$2"
#!/bin/bash
convert in.jpg \( +clone -blur 0x20 \) -compose Divide_Src -composite -normalize -level 10%,90% -deskew 40% -unsharp 0x5+2+0 out.jpg

Description

This simple script will take a picture of a whiteboard and use parts of the ImageMagick library with sane defaults to clean it up tremendously.

The script is here:

#!/bin/bash
convert "$1" -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 "$2"

Results

@Frodox
Frodox / GPL.md
Created April 2, 2014 19:56 — forked from jnrbsn/GPL.md

GNU GENERAL PUBLIC LICENSE

Version 3, 29 June 2007

Copyright © 2007 Free Software Foundation, Inc. <http://fsf.org/>

Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.

@Frodox
Frodox / count_char.sh
Last active January 4, 2016 19:09
Count char accourence
#!/bin/bash
$ echo "qwertyuuiop cxcx xcxc x x xc x" | tr -cd ' '|wc -c
# work with unicode
$ echo "qwertyuuiop cxcx xcxc x x xc x" | grep -o 'x'|wc -l
@Frodox
Frodox / is_cpp.c
Created January 28, 2014 10:20
compiler's funs
#include <stdio.h>
int main()
{
int is_cpp = -1 + 2//**/2
;
if (is_cpp)
printf ("C++\n");
else
printf ("C\n");