Skip to content

Instantly share code, notes, and snippets.

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

Mike Yakymenko mikeyakymenko

🏠
Working from home
View GitHub Profile
@mikeyakymenko
mikeyakymenko / PIL thumbs
Last active December 31, 2015 11:49
Python thumbs
from PIL import Image, ImageOps
import urllib2 as urllib
import io
fd = urllib.urlopen("http://a/b/c")
image_file = io.BytesIO(fd.read())
im = Image.open(image_file)
THUMB_SIZE = 150, 150

Port Forwarding in Mavericks (80 to 8080)


Guide to add localhost:80 to localhost:8080 forwarding.

Since Mavericks stopped using the deprecated ipfw (as of Mountain Lion), we'll be using pf to allow port forwarding.

####1. anchor file

@mikeyakymenko
mikeyakymenko / mgpost
Last active August 29, 2015 13:56
simple generate file for blog post, for FlaskFlatpages
#!/usr/bin/env python
# coding: utf-8
# usage
# clone file
# change content_path variable
# chmod +x blogadd
# mv blogadd /usr/local/bin/blogadd
@mikeyakymenko
mikeyakymenko / timer.py
Last active August 29, 2015 13:58
Скрипт был написан мною, когда я начал изучать Python. Таймер на 30 минут, что бы не засидется за компом.
#!/usr/bin/env python
# coding: utf-8
#Автор Михаил Якименко - macgera.name
#Скрипт которой я написал в ходе изучения Python.
#Этот скрипт работает в Ubuntu если установлен пакет notify-send
#Так же он может работать и в Mac OS X и Windows,
#но в таком случае прийдется менять строки (команды) с уведомлением.
@mikeyakymenko
mikeyakymenko / payment.py
Created April 10, 2014 22:38
Скрипт был написан мною, когда я начал изучать Python. Простой подсчет зарплаты.
#!/usr/bin/env python
# coding: utf-8
# Автор Михаил Якименко - macgera.name
# Подсчет процентов от продаж. И общую сумму продаж.
# Подразумевается наличие некой базы. Простого текстового файла.
# Базы данных мнимых подаж.
// tests
// returns height of the screen including all toolbars
// requires detection of orientation. (320px for our test)
// window.orientation === 0 ? screen.height : screen.width
// returns height of the visible area
// it decreases if you zoom in
// window.innerHeight
// returns height of screen minus all toolbars
'use strict';
/**
* Equal Heights
*
* Attach this directive to the parent/wrapping element of
* a bunch of elements that are columns. This directive will
* calculate the height of every direct child (one level down)
* then set all of them to be the height of the tallest one.
*
@mikeyakymenko
mikeyakymenko / gist:f682f1afd2edc0d43c1d
Created February 18, 2015 01:58
Sublime minimal config
{
"color_scheme": "Packages/themes/Laravel.tmTheme",
"default_encoding": "UTF-8",
"ensure_newline_at_eof_on_save": true,
"fallback_encoding": "UTF-8",
"font_size": 12,
"ignored_packages":
[
"Vintage"
],
# Regular Colors
\[\033[0;30m\] # Black
\[\033[0;31m\] # Red
\[\033[0;32m\] # Green
\[\033[0;33m\] # Yellow
\[\033[0;34m\] # Blue
\[\033[0;35m\] # Purple
\[\033[0;36m\] # Cyan
\[\033[0;37m\] # White
@mikeyakymenko
mikeyakymenko / file.ini
Last active August 29, 2015 14:17
supervisor example config
[uwsgi]
plugins = python27
virtualenv = /home/toor/.envs/greendog
chdir = /home/toor/projects/greendog
pidfile=/home/toor/projects/greendog.pid
pythonpath = ..
env = DJANGO_SETTINGS_MODULE=greendog.settings
module=django.core.wsgi:get_wsgi_application()
touch-reload = /tmp/project_greendog.txt
socket=127.0.0.1:8034