Skip to content

Instantly share code, notes, and snippets.

View tomekwojcik's full-sized avatar
🤷‍♂️
¯\_(ツ)_/¯

Tomek Wójcik tomekwojcik

🤷‍♂️
¯\_(ツ)_/¯
View GitHub Profile
@tomekwojcik
tomekwojcik / hack.sh
Last active February 22, 2017 10:48 — forked from erikh/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
from UserDict import UserDict
class RamDB(UserDict):
pass
@tomekwojcik
tomekwojcik / pythonmagick_osx.md
Created May 23, 2012 22:45
PythonMagick on OS X

Installing PythonMagick on OS X

  1. brew install boost - will take a lot of time and make your Mac hot
  2. brew install --with-magick-plus-plus imagemagick
  3. cd <path_to_PythonMagick_source>
  4. ./configure --with-boost=<path_to_boost_root>
  5. make
  6. make install
  7. python -c "import PythonMagick"
@tomekwojcik
tomekwojcik / proptest.py
Created May 10, 2012 17:33
Python @Property vs direct access
# -*- coding: utf-8 -*-
from timeit import timeit
setup = """\
class Test(object):
def __init__(self, something):
self._something = something
@property
def something(self):
<?php
class string {
protected $_src = null;
public function __construct($src = '') {
$this->_src = $src;
}
public function __toString() {
return $this->_src;
@tomekwojcik
tomekwojcik / wtfpasswdapi.md
Created December 24, 2011 15:20
Why The Fuck Should I Use An API For "What The Fuck Should I Use For Password"?

Why The Fuck Should I Use An API For "What The Fuck Should I Use For Password"?

What The Fuck Should I Use For Password? wouldn't be much of a Web 2.0 app if it didn't provide an API. Using this API you can get a pseudo-random string in JSON or plaintext form.

Query format

http://whatthefuckshouldiuseforpassword.com/*format*?*query_string*

Formats

@tomekwojcik
tomekwojcik / makepwd.py
Created December 21, 2011 21:12
Tweet-sized password "generator" in Python.
import random; ''.join([ chr(i).lower() for i in random.sample(range(48, 57) + range(65, 90), 8) ])
@tomekwojcik
tomekwojcik / gist:1180217
Created August 30, 2011 04:57
Dirty fix for Flask's bug with static files.
# default is the blueprint object
@default.route('/files/<path:path>')
def files(path):
return default.send_static_file(path)
@tomekwojcik
tomekwojcik / cdlib.rb
Created July 17, 2011 16:38
My first Ruby "app".
# -*- coding: utf-8 -*-
VERSION = "1.0"
DEFAULT_LIBRARY = "library.cdlib"
class Library
attr_reader :entry_fields
attr_accessor :path
def initialize(path=DEFAULT_LIBRARY)
@tomekwojcik
tomekwojcik / flask-formreuse-app.py
Created May 3, 2011 09:06
Flask mini-app demoing WTForms reuse
from flask import Flask, render_template, flash, request
from werkzeug.datastructures import MultiDict
from flaskext.wtf import Form, TextField, TextAreaField, validators
# App config.
DEBUG = True
SECRET_KEY = '87469976308fd14a2d0148247d441f2756b6176a'
app = Flask(__name__)
app.config.from_object(__name__)