Skip to content

Instantly share code, notes, and snippets.

View flavius's full-sized avatar

Flavius Aspra flavius

View GitHub Profile
@flavius
flavius / zerologger.py
Created July 10, 2011 18:53 — forked from gwik/zerologger.py
Python logger ZeroMQ, Gevent, CouchDB
# encoding: utf-8
"""
A python logging Handler that use ZeroMQ (ØMQ).
+------+ +------+ +-------+
| app1 | | app2 | | app X |
+------+ +------+ +-------+
| PUSH | PUSH | PUSH
#include <stdlib.h>
#include <stdio.h>
#include "stack.h"
void push(struct node** first, struct node** addAfter, const char val){
struct node* top;
top = malloc(sizeof(struct node*));
top->val = val;
@flavius
flavius / primul
Created February 15, 2012 16:55
Solutii_yet_another_project
tioiutou
function! ToggleFlagOptionValue(option, flag)
exe "set " . a:option . eval("&" . a:option . " =~# '" . a:flag . "' ? '-=" . a:flag . "' : '+=" . a:flag . "'")
endfunction
echo &go
call ToggleFlagOptionValue('go', 'T')
call ToggleFlagOptionValue('go', 'r')
echo &go
# for flag in ['T', 'r'] | call ToggleFlagOptionValue('go', flag) | endfor
<?php
$url = 'http://forum.antichat.ru/thread20301.html';
function getfile($url,$num) {
echo "$url";
$content = file_get_contents($url);
echo nl2br($content);
$fp = fopen($num.".txt", 'write');
fwrite($fp, nl2br($content));
fclose($fp);
return $content;
<?php
/**
* File: database.class.php
* Super simple PDO class
*
* Author: Jeremy Morgan
* Author: Flavius Aspra <[email protected]>
*
* This is just a start. No error handling or parameterization yet
*/
" HJKL repetition trap
" Barry Arthur, 2013-03-14
" depends on your :help 'updatetime setting
let g:cursor_moving = 0
function! TrapMovementKeys(key)
augroup CursorMoving
au!
autocmd CursorMoved * let g:cursor_moving = 1
@flavius
flavius / git_intro.txt
Last active December 24, 2015 08:59 — forked from sarvsav/git_intro.txt
Introduction to git
What is git?
- git is basically, a version control system where you can collaborate with
other and work on your projects. Developed by Linus.
Advantages of using git over other version system?
- git maintains snapshot of your projects, while other SVN store the diff for every change.
- git uses SHA1, so data loss is almost impossible (checks for data integrity).
- git maintains the local database, so the search is faster as compare to other.

100k Requests -- 100 concurrent clients

ab -n 100000 -c 100 -k http://127.0.0.1:1337/

Server Software:        
Server Hostname:        127.0.0.1
Server Port:            1337

Document Path:          /
from collections import defaultdict
def toposort(graph):
"""http://code.activestate.com/recipes/578272-topological-sort/
Dependencies are expressed as a dictionary whose keys are items
and whose values are a set of dependent items. Output is a list of
sets in topological order. The first set consists of items with no
dependences, each subsequent set consists of items that depend upon
items in the preceeding sets.