Skip to content

Instantly share code, notes, and snippets.

View iho's full-sized avatar
🏠
Working from home

iho iho

🏠
Working from home
  • Kyiv, Ukraine
  • 12:49 (UTC +02:00)
View GitHub Profile
@iho
iho / emoji.py
Last active September 15, 2015 14:57 — forked from nitely/emoji.py
Emojis for python-Markdown
#-*- coding: utf-8 -*-
# Tested on Markdown 2.3.1
#
# Copyright (c) 2014, Esteban Castro Borsani
# The MIT License (MIT)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
http://nginx.org/patches/http2/README.txt
./configure --with-http_ssl_module\
--with-http_v2_module \
# --with-http_spdy_module \
--with-http_gzip_static_module \
--with-ipv6 --with-http_realip_module \
--with-http_stub_status_module
@iho
iho / blocks.py
Last active October 22, 2015 20:55 — forked from frankwiles/blocks.py
Code and Markdown blocks for Wagtail 1.0 StreamField
from django.utils.safestring import mark_safe
from markdown import markdown
from pygments import highlight
from pygments.formatters import get_formatter_by_name
from pygments.lexers import get_lexer_by_name
from wagtail.wagtailcore import blocks
class CodeBlock(blocks.StructBlock):
@iho
iho / flask-admin many-to-many search.md
Last active August 29, 2015 14:26 — forked from riteshreddyr/flask-admin many-to-many search.md
Flask-admin Many-to-Many Search and Filtering

#Flask-admin Many-to-Many Search

Many-to-Many searches are not easily supported by Flask-admin. Read Here for more info

##Solution

  • Add the association tables to the list of join tables so that the join between the two tables can be made through the association table.
  • Reverse the tables to ensure that the association tables are processed before the other join table.

Tested on Flask-Admin 1.1.0

def first(matrix):
m = matrix[1::2]
return map(sum, zip(*m))
def second(string):
res = 0
for word in string.split(' '):
l = len(word)
if l > res:
import datetime
import asyncio
class InMemoryCache:
data = {}
time = {}
func = None
live = 10 # seconds
size = 100
fixed_size = False
@iho
iho / ckedit.py
Last active August 29, 2015 14:22 — forked from mrjoes/ckedit.py
from flask import Flask
from flask.ext.sqlalchemy import SQLAlchemy
from flask.ext import admin, wtf
from flask.ext.admin.contrib import sqlamodel
app = Flask(__name__)
app.config['SECRET_KEY'] = '123456790'
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///test.sqlite'
db = SQLAlchemy(app)
@iho
iho / ckedit.py
Last active August 29, 2015 14:22 — forked from dengshuan/ckedit.py
from flask import Flask
from flask.ext.sqlalchemy import SQLAlchemy
from flask.ext import admin
from wtforms import TextAreaField
from wtforms.widgets import TextArea
from flask.ext.admin.contrib.sqla import ModelView
app = Flask(__name__)
app.config['SECRET_KEY'] = '123456790'
@iho
iho / .zshrc
Last active July 12, 2016 11:15
ZSH=$HOME/.oh-my-zsh
#set -e
#export CHROMIUM_USER_FLAGS="--disk-cache-dir=/tmp --disk-cache-size=50000000"
ZSH_THEME="robbyrussell"
# ZSH_THEME="kolo"
DEFAULT_USER="ihor"
[push]
default = matching
[user]
name = Ihor Gorobets
email = ihorgorobets@gmail.com
[color]
ui = true
[alias]
c = commit -m
aa = add .