Skip to content

Instantly share code, notes, and snippets.

@paulmouzas
paulmouzas / throttle.py
Created January 20, 2016 21:47 — forked from ChrisTM/throttle.py
Python decorator for throttling function calls.
class throttle(object):
"""
Decorator that prevents a function from being called more than once every
time period.
To create a function that cannot be called more than once a minute:
@throttle(minutes=1)
def my_fun():
pass
@paulmouzas
paulmouzas / README.md
Created January 11, 2016 21:04 — forked from gsomoza/README.md
Magento CLI Media Cleaner

Magento CLI Media Cleaner

CLI utilities to clean the Magento media folders.

Features:

  • Clean unused images from the product catalog.
  • Clean the product catalog image cache.
  • Ready to use: automatically reads settings from app/etc/local.xml
  • FAST: I used it to safely clean about 45,000 images in just a couple of minutes.
@paulmouzas
paulmouzas / normalise.py
Created December 29, 2015 15:04 — forked from j4mie/normalise.py
Normalise (normalize) unicode data in Python to remove umlauts, accents etc.
# -*- coding: utf-8 -*-
import unicodedata
""" Normalise (normalize) unicode data in Python to remove umlauts, accents etc. """
data = u'naïve café'
normal = unicodedata.normalize('NFKD', data).encode('ASCII', 'ignore')
print normal
@paulmouzas
paulmouzas / data.csv
Last active August 29, 2015 14:26 — forked from eightysteele/data.csv
Unicode DictReader and DictWriter
id name age
0 aaron 34
1 tina 36
2 noah ©

Pressman is a two-player board-game where opponents try to capture all of the other player's SOLDIERS. The SOLDIERS are round black and white pieces similar in size to checker pieces. The board is an 8x8 grid of 64 squares of alternating light and dark color (similar to a checkers or chess board) called the BATTLEFIELD.

At the beginning of the game one player has 28 white SOLDIERS and the other other has 28 black SOLDIERS. Players set up their pieces by filling up the first two rows that are closest to them with 16 of their 28 SOLDIERS as shown in the diagram below:

The remaining pieces are placed off to the side of the board for later use.

Movement and Capturing of SOLDIERS

The BATTLEFIELD is divided into eight vertical columns, called FILES, and eight horizontal rows, called FLANKS. All Pressman SOLDIERS move similar to a queen does in the game of chess. They can move horizontally along FLANKS, vertically along FILES, or diagonally.