Skip to content

Instantly share code, notes, and snippets.

View pkulev's full-sized avatar

Pavel Kulyov pkulev

View GitHub Profile
@pkulev
pkulev / cparse.c
Created December 28, 2015 17:38
Игра с подливой
#include <fcntl.h>
#include <sysexits.h>
#include <unistd.h>
char * strcat(char *dest, char *src)
{
while (*dest) dest++;
while (*dest++ = *src++);
return --dest;
@pkulev
pkulev / fixture.py
Created February 3, 2016 16:52
fixture
import pytest
@pytest.fixture(scope="module")
def test(request):
try:
# set up
pass
except:
# tear down
pass
#include <stdio.h>
#include <stdlib.h>
int pow2(int val)
{
return val * val;
}
int* map(int (*func)(int), int *arr, int len)
{
@pkulev
pkulev / sim.py
Last active March 14, 2016 14:01
#!/usr/bin/env python
import random
try:
ask = raw_input
except NameError:
ask = input
@pkulev
pkulev / omg.py
Last active March 22, 2016 12:42
#!/usr/bin/env python
"""Just for fun."""
import sys
from OpenGL.GL import (
glClear,
glClearColor,
glRotatef,
>>> def normalize(vector):
... normalized = []
... for elem in vector:
... normalized.append(elem / 255.)
... return normalized
...
>>> normalize((1,2,3))
[0.00392156862745098, 0.00784313725490196, 0.011764705882352941]
>>> normalize((0, 0, 0))
[0.0, 0.0, 0.0]
"""Data frame for convinient work and renderings multipage data."""
import math
class DataFrame(list):
"""Data represents as granulated list of lists.
DataFrame is a list, thus you can access elements directly like
with original list structure: dataframe[index] -> element
Also you can granulate (more than once) list of frames by frame length
#!/usr/bin/env python
from OpenGLContext import testingcontext # noqa
from OpenGLContext.arrays import array
from OpenGL.arrays import vbo
from OpenGL.GL import (
shaders,
glEnableClientState,
glDisableClientState,
glDrawArrays,
# Path to your oh-my-zsh installation.
export ZSH=/home/pkulev/.oh-my-zsh
# Set name of the theme to load.
# Look in ~/.oh-my-zsh/themes/
# Optionally, if you set this to "random", it'll load a random theme each
# time that oh-my-zsh is loaded.
ZSH_THEME="obraun"
# Uncomment the following line to use case-sensitive completion.
[user]
name = Pavel Kulyov
email = pkulev@croc.ru
[core]
editor = "emacs -nw"
diff = auto
status = auto
branch = auto
interactive = auto
excludesfile = /home/pkulev/.gitignore