Skip to content

Instantly share code, notes, and snippets.

View marazmiki's full-sized avatar

Mikhail Porokhovnichenko marazmiki

View GitHub Profile
@marazmiki
marazmiki / to_ipod.py
Created August 14, 2011 20:29 — forked from dpetzold/to_ipod.py
Convert and video to ipod viewable using ffmpeg capturing the output to a display the encoding progress.
#!/usr/bin/python
import fcntl
import optparse
import os
import progressbar
import re
import select
import shlex
import subprocess
@marazmiki
marazmiki / authuser.md
Created June 30, 2012 19:33 — forked from jacobian/authuser.md
Upgrading auth.User - the profile approach

Upgrading auth.User - the profile approach

This proposal presents a "middle ground" approach to improving and refactoring auth.User, based around a new concept of "profiles". These profiles provide the main customization hook for the user model, but the user model itself stays concrete and cannot be replaced.

I call it a middle ground because it doesn't go as far as refactoring the whole auth app -- a laudable goal, but one that I believe will ultimately take far too long -- but goes a bit further than just fixing the most egregious errors (username length, for example).

This proposal includes a fair number of design decisions -- you're reading the fifth or sixth draft. To keep things clear, the options have been pruned out and on the one I think is the "winner" is still there. But see the FAQ at the end for some discussion and justification of various choices.

The User model

@marazmiki
marazmiki / sticky.css
Created November 14, 2012 08:53 — forked from mokagio/sticky.css
Twitter Bootstrap + Sticky Footer + Fixed Nav Bar
html, body, .container, .content {
height: 100%;
}
.container, .content {
position: relative;
}
.proper-content {
padding-top: 40px; /* >= navbar height */
@marazmiki
marazmiki / gist:4214368
Created December 5, 2012 09:50 — forked from michelts/gist:1029336
FormsView
from django.views.generic.base import View, TemplateResponseMixin
from django.views.generic.edit import FormMixin, ProcessFormView
class MultipleFormsMixin(FormMixin):
"""
A mixin that provides a way to show and handle several forms in a
request.
"""
form_classes = {} # set the form classes as a mapping
from django.views.generic.base import View, TemplateResponseMixin
from django.views.generic.edit import FormMixin, ProcessFormView
class MultipleFormsMixin(FormMixin):
"""
A mixin that provides a way to show and handle several forms in a
request.
"""
form_classes = {} # set the form classes as a mapping
mkdir -p reports
REPO="http://127.0.0.1:8888"
echo Checking for local repo at ${REPO}
curl -f --head ${REPO} > /dev/null 2>&1 || REPO='http://pypi.python.org/simple'
echo "... will use ${REPO}"
echo 'Creating "venv" environment...'
virtualenv --distribute --no-site-packages venv
@marazmiki
marazmiki / waveform.c
Created September 1, 2014 16:29 — forked from dz0ny/waveform.c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <groove/groove.h>
#include <limits.h>
//compile with gcc -o waveform main.c -O3 -lgroove -std=c99
// Define a vector type
typedef struct {
#!/bin/bash
usage()
{
cat << EOF
usage: $0 options
This script set ownership for all table, sequence and views for a given database
Credit: Based on http://stackoverflow.com/a/2686185/305019 by Alex Soto
# dependency - Function.prototype.bind or underscore/lodash
app = angular.module 'someApp'
class @BaseCtrl
@register: (app, name) ->
name ?= @name || @toString().match(/function\s*(.*?)\(/)?[1]
app.controller name, @
@inject: (args...) ->
@marazmiki
marazmiki / gulpfile.js
Last active August 29, 2015 14:18 — forked from ktmud/gulpfile.js
var BatchStream = require('batch-stream2')
var gulp = require('gulp')
var coffee = require('gulp-coffee')
var uglify = require('gulp-uglify')
var cssmin = require('gulp-minify-css')
var bower = require('gulp-bower-files')
var stylus = require('gulp-stylus')
var livereload = require('gulp-livereload')
var include = require('gulp-include')
var concat = require('gulp-concat')