Skip to content

Instantly share code, notes, and snippets.

View vsyrovat's full-sized avatar

Valentin Syrovatskiy vsyrovat

View GitHub Profile

Libuv and libev, two I/O libraries with similar names, recently had the privilege to use both libraries to write something. Now let's talk about my own subjective expression of common and different points.

The topic of high-performance network programming has been discussed. Asynchronous, asynchronous, or asynchronous. Whether it is epoll or kqueue, it is always indispensable to the asynchronous topic.

Libuv is asynchronous, and libev is synchronous multiplexing IO multiplexing.

Libev is a simple encapsulation of system I/O reuse. Basically, it solves the problem of different APIs between epoll and kqueuq. Ensure that programs written using livev's API can run on most *nix platforms. However, the disadvantages of libev are also obvious. Because it basically just encapsulates the Event Library, it is inconvenient to use. For example, accept(3) requires manual setnonblocking after connection. EAGAIN, EWOULDBLOCK, and EINTER need to be detected when reading from a socket. This is a

# Based on https://gist.github.com/laggardkernel/6cb4e1664574212b125fbfd115fe90a4
# create a PROPMT_COMMAND equivalent to store chpwd functions
typeset -g CHPWD_COMMAND=""
_chpwd_hook() {
shopt -s nullglob
local f
#!/usr/bin/env bash
set -eo pipefail
#CC=/usr/bin/gcc-8
# CFLAGS="-O3 -pipe -march=native -mtune=generic"
echo "CC=\"$CC\""
echo "CFLAGS=\"$CFLAGS\""
echo "CXXFLAGS=\"$CXXFLAGS\""
echo "MAKEFLAGS=\"$MAKEFLAGS\""
#!/usr/bin/env bash
PRE_COMMIT_HOOK_FILE=".git/hooks/pre-commit"
if [[ -f $PRE_COMMIT_HOOK_FILE ]]; then
echo "File .git/hooks/pre-commit already exists"
ls -lsah $PRE_COMMIT_HOOK_FILE
cat $PRE_COMMIT_HOOK_FILE
exit 1
else
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point> <type> <options> <dump> <pass>
/dev/vda2 / ext4 errors=remount-ro 0 1
# Swap file (manually added)
/swapfile none swap sw 0 0
rails new demo && cd demo
rails g scaffold parent name:string age:integer
rails g scaffold toy parent_id:integer
""" прописываем belongs_to и has_many в моделях """
rake db:migrate
@vsyrovat
vsyrovat / base.tpl
Created November 21, 2013 06:54
Template Principles pt. 3
<html>
<head>
<title>{$title}</title>
</head>
<body>
{% block body %}{% endblock %}
<div class="footer">
<p class="copyrights">&copy; Ololo team</p>
<p class="contacts">Call us: +1 123 456 789</p>
</div>
@vsyrovat
vsyrovat / base.haml
Last active December 28, 2015 23:09
Template Principle, pt. 2
html
head
title
= yield(:title)
body
= block body
.footer
p.copyrignts '&copy; Ololo team'
p.contacts 'Call us: +1 123 456 789'
@vsyrovat
vsyrovat / index.haml
Last active December 28, 2015 23:09
Template Principle, pt. 1
html
head
title
= yield(:title)
body
p 'Some intro text for index page'
.main
= yield
.footer
p.copyrignts '&copy; Ololo team'