Skip to content

Instantly share code, notes, and snippets.

@barrachri
barrachri / duration.py
Created January 7, 2016 16:52
code for ep2016
TALK_TYPE = (
('t_30', 'Talk (30 mins)'),
('t_45', 'Talk (45 mins)'),
('t_60', 'Talk (60 mins)'),
('i_60', 'Interactive (60 mins)'),
('r_180', 'Training (180 mins)'),
('p_180', 'Poster session (180 mins)'),
('p_60', 'Panel (60 mins)'),
('p_90', 'Panel (90 mins)'),
('h_180', 'Help desk (180 mins)'),
@barrachri
barrachri / ex_1.py
Created July 25, 2016 15:32
Python Code
class A():
x = 1
a = A()
b = A()
b.x = 11
a.x # ?
@barrachri
barrachri / proxy_server.py
Created November 9, 2016 10:44
Proxy Server with aiohttp
import logging
import sys
from urllib.parse import urljoin
import asyncio
import aiohttp
from aiohttp import web
TARGET_SERVER_BASE_URL = 'http://127.0.0.1:8888'
@barrachri
barrachri / django.po
Last active November 18, 2016 00:35
translation_example
#: blog/templates/blog.html:111
msgid ""
"\n"
" <p>We are going to publish some blog post as soon as "
"possible !</p>\n"
"\n"
" "
msgstr ""
"\n"
" <p>-------Polish text here-----</p>\n"
@barrachri
barrachri / 100_base.conf
Created February 12, 2017 20:29 — forked from danackerson/100_base.conf
using nginx + lua + redis for redirects and rewrites
# using such a setup requires `apt-get install lua-nginx-redis` under Ubuntu Trusty
# more info @ http://wiki.nginx.org/HttpLuaModule#access_by_lua
http {
lua_package_path "/etc/nginx/include.d/?.lua;;";
lua_socket_pool_size 100;
lua_socket_connect_timeout 10ms;
lua_socket_read_timeout 10ms;
server {
from collections import namedtuple
from sys import getsizeof
from typing import NamedTuple
test_namedtuple = namedtuple("TEST", "a b c d f")
a = test_namedtuple(a=1,b=2,c=3,d=4,f=5)
class TestSlots():
__slots__ = ["a","b","c","d","f"]
FROM komljen/ubuntu
MAINTAINER Alen Komljen <[email protected]>
RUN \
apt-get update && \
apt-get -y install \
redis && \
rm -rf /var/lib/apt/lists/*
RUN rm /usr/sbin/policy-rc.d
FROM python:3.6.1-alpine
CMD python -c "while True: print('Hello Python')"
import asyncio
import logging
import aiohttp
from aiohttp import web
from auth.utils import login_required
import aiodocker
from aiodocker.docker import Docker
from aiodocker.exceptions import DockerError
log = logging.getLogger(__name__)
import asyncio
import random
class Genropy:
_number = None
@property
def number(self):