Skip to content

Instantly share code, notes, and snippets.

View ochaton's full-sized avatar

Vladislav Grubov ochaton

View GitHub Profile
local Fabric = {}
Fabric.__metatable = {}
setmetatable(Fabric, Fabric.__metatable)
local Class = {}
Class.__metatable = {}
setmetatable(Class, Class.__metatable)
function Class.__metatable:__call(classname)
local mt = {
if [ "$color_prompt" = yes ]; then
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;31m\]\u\[\033[01;33m\]@\[\033[01;36m\]\h \[\033[01;33m\]\w \[\033[01;35m\]\$ \[\033[00m\]'
else
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
fi
unset color_prompt force_color_prompt
# If this is an xterm set the title to user@host:dir
case "$TERM" in
xterm*|rxvt*)
@ochaton
ochaton / tube.cpp
Last active February 7, 2017 20:55
Class Tube on C++11 uses ev++ and some benefits of C++11
/*
* Compile with: g++ -std=c++11 -Werror -O2 tube.cpp -o tube -lev
*
*/
#include <ev++.h>
#include <functional>
#include <iostream>
#include <stdexcept>
#include <memory>
@ochaton
ochaton / ev_read.c
Created February 3, 2017 23:15
Read Example of libev in C
#include <ev.h>
#include <unistd.h>
#include <stdio.h>
#include <fcntl.h>
#include <errno.h>
#include <string.h>
#include <strings.h>
void on_error(struct ev_loop * loop, ev_io * w) {