Skip to content

Instantly share code, notes, and snippets.

Avatar

Jan Killian iki

View GitHub Profile
@iki
iki / Questions
Created Jun 26, 2011
Kiwi Pycon Give-away
View Questions
GitHub username: iki
Day job: freelance dev
Favorite open source project: linux, python, ruby
Open Source contributions (if any): python modules
Stranded on an island, what 3 items do you take: zippo, machette, solar powered netbook with gps
Tie-breaker, pick a number between 1 and 20,000: 2829
View wordlist.py
#!/usr/bin/env python
"""Test wordlist parsing speed.
See http://news.ycombinator.com/item?id=2716714
Use with /usr/share/dict/words,
or e.g. http://www.freebsd.org/cgi/cvsweb.cgi/src/share/dict/web2?rev=1.14;content-type=text/plain
"""
import pickle
@iki
iki / accept_languages.py
Created Nov 28, 2011 — forked from filippo/accept_languages.py
decode HTTP_ACCEPT_LANGUAGE headers
View accept_languages.py
def accept_languages(browser_pref_langs):
"""Parses the request and return language list.
browser_pref_langs is the plain Accept-Language http request header
value.
Stolen from Products.PloneLanguageTool, under GPL (c) Plone Foundation,
slightly modified.
Taken from tweetengine http://github.com/Arachnid/tweetengine/
"""
browser_pref_langs = browser_pref_langs.split(',')
i = 0
@iki
iki / make_deb.sh
Created Oct 11, 2012
building deb packages for python projects - just snippet to see how to
View make_deb.sh
make_deb () { # dscfile|srcdir [destdir] [[backportable:] build_dependencies..] [signkey_id] [buildpackage_options..]
local S D BD K SA SX SI ST T W X AA A
S="$1"; D="${2:-.}"; BD="$3"; K="$4"; [ $# -ge 4 ] && shift 4 || shift $#
[ -d "$S" ] && SA='debian source control' && SX='temporary' && SI="$S/debian/control" && ST="$S/debian/changelog"
[ ! -d "$S" ] && SA='debian source archive' && SX='extracted' && SI="$S" && ST=
check_file existing: "$SA" "$SI" || return $?
[ -f "$ST" ] || ST="$SI"
@iki
iki / secure_view_method.py
Created Oct 29, 2012
Secure:always view method decorator for Google App Engine - workaround for issue 7979
View secure_view_method.py
import os
import logging
from functools import update_wrapper
def secure(view_method):
"""Decorates view/handler method to redirect to https if requested over http.
Equivalent to handler setting secure:always in app.yaml.
Provided as a workaround for App Engine issue 7979.
@iki
iki / vc.bat
Last active Nov 19, 2015
Visual Studio 10/11/14 environment setup for python, or node.js/node-gyp. Determines VS version and architecture, calls respective vcVarsAll.bat and sets vcTargetsPath if needed.
View vc.bat
@echo off
setlocal enableextensions
::: echo === "%~f0" %* >&2
set vcArgs=%*
set vcVersions=14 11 10
call :poparg vcArgs vcVersions 10 10 %1 && shift
call :poparg vcArgs vcVersions 11 11 %1 && shift
View api-ga-gae.md

Using API's on Google App Engine

Demo and code

Missing presentable (non-internal) implementation atm. Maybe on later Pyvo's:

>>> from __future__ import demo
@iki
iki / README.md
Last active Dec 14, 2015
Building Angular.js on Windows
View README.md

Building Angular.js on Windows

Current grunt based build

  1. Install grunt launcher.

     npm install -g grunt-cli
    
  2. Run grunt as Administrator. That's needed to create directory symlinks using mklink /d.

View ngseed.md

CleverStack

Angular Seed

YAAS (Yet Another Angular Seed)

While know about the existence of ng-boilerplate, the angular-app repo on Github, or even Yeoman and it's angular-generator, none of those really fit the bill when it comes to structuring a medium to large application as it often is the case here at Clevertech.

This is not yet another angular seed: this is the collaborative effort of open source enthusiasts to solve the most of the problems in AngularJS development. Yes, we took the liberty of adding a bit of a bleak packaging but that allows us for dead-easy installing, upgrading and extending.

Let's dive into it.