Skip to content

Instantly share code, notes, and snippets.

View evandrix's full-sized avatar
💭
offline

evandrix evandrix

💭
offline
View GitHub Profile
Select Transformation
Invert Transformation
End Transformation
Empty Transformation
Remove Transformation
Unwrap Transformation
Wrap Transformation
Trace Transformation
Filter Transformation
Map Transformation
@evandrix
evandrix / README
Created July 22, 2011 15:05
TracPlugin: Minimal implementation
+-plugin-log/
|
+-logpackage/
| |
| +-__init__.py
| |
| +-logplugin.py
|
+-setup.py
@evandrix
evandrix / print_dir_tree.py
Created July 21, 2011 14:38
Print Directory Tree Structure (with/without files)
#! /usr/bin/env python
# tree.py
#
# Written by Doug Dahms
#
# Prints the tree structure for the path specified on the command line
from os import listdir, sep
from os.path import abspath, basename, isdir
@evandrix
evandrix / README
Created July 21, 2011 13:17
TracPlugin: "Hello World" (/helloworld-plugin) @ http://trac-hacks.org/wiki/EggCookingTutorialTrac0.11
=== Directory tree structure
+-helloworld-plugin/
|
+-helloworld/
| |
| +-__init__.py
| |
| +-templates/
| | |
@evandrix
evandrix / rudix.py
Created July 15, 2011 23:38
/usr/local/bin/rudix fix
# add try-catch block to ignore exceptions raised from re.findall()
def get_versions_for_package(pkg):
'Get a list of available versions for package'
pkg = denormalize(pkg)
content = urlopen('http://code.google.com/p/rudix/downloads/list?q=Filename:%s' % pkg).read()
try:
urls = re.findall('(rudix.googlecode.com/files/(%s-([\w.]+(?:-\d+)?(?:.i386)?)(\.dmg|\.pkg)))' % pkg, content)
versions = sorted(list(set(urls)), cmp=lambda x, y: version_compare(x[2], y[2]))
@evandrix
evandrix / API-Levels.txt
Created July 15, 2011 15:56
Android Application Development
Platform Version API Level
================ =========
Android 3.1 12
Android 3.0 11
Android 2.3.4 10
Android 2.3.3
Android 2.3 9
Android 2.2 8
Android 2.1 7
Android 2.0.1 6
@evandrix
evandrix / wisdom.pl
Created July 15, 2011 15:52
Perls of wisdom
# Add line numbers to file
cat file | perl -wne 'while (<STDIN>) { print "$. $_" }'
# Add '!' prefix for WikiFormatting of classnames
# pattern:
# - 2 or more capital letters
# - no consecutive capital letters
# or use {{{ ... }}} for preformatted code block
cat file | grep -v "^\s*$" | sed -e "s/$/ [[br]]/g" | perl -wne '$_ =~ s/(?!\w*[A-Z]{2,}\w*)((?<!")[A-Z]\w+[A-Z]\w+)/!$1/g; print;'
@evandrix
evandrix / favourites.sh
Created July 15, 2011 12:16
Commandlinefu.com
# http://www.commandlinefu.com/commands/favourites/plaintext
# commandlinefu.com by David Winterbottom
# Repoint an existing symlink to a new location
ln -nsf <TARGET> <LINK>
# RDP through SSH tunnel
ssh -f -L3389:<RDP_HOST>:3389 <SSH_PROXY> "sleep 10" && rdesktop -T'<WINDOW_TITLE>' -uAdministrator -g800x600 -a8 -rsound:off -rclipboard:PRIMARYCLIPBOARD -5 localhost
# Control ssh connection
@evandrix
evandrix / AndroidPaint.java
Created July 13, 2011 22:58
Working with Images in Android
package com.exercise.AndroidPaint;
import android.app.Activity;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.os.Bundle;
import android.view.View;
@evandrix
evandrix / monads.cpp
Created July 13, 2011 21:53
Monads in C++ / Template Haskell [Metaprogramming]
$ ghci -XTemplateHaskell
Prelude> :m +Language.Haskell.TH
Prelude Language.Haskell.TH> runQ [| let x = 5 in x * x |]
LetE [ValD (VarP x_0) (NormalB (LitE (IntegerL 5))) []] (InfixE (Just (VarE x_0)) (VarE GHC.Num.*) (Just (VarE x_0)))
Prelude Language.Haskell.TH> $(runQ [| let x = 5 in x * x |])
25