Skip to content

Instantly share code, notes, and snippets.

@mrahma01
mrahma01 / rmpyc
Created Aug 30, 2013
Find all pyc file and remove it
View rmpyc
find . -name "*.pyc" -exec rm -rf {} \;
View gist:5138639
def validate_email(email):
pattern = '[\.\w]{1,}[@]\w+[.]\w+'
if re.match(pattern, email):
print email
return True
else:
return False
@mrahma01
mrahma01 / vagrant list
Created Oct 18, 2012
The list to follow for a new vagrant box
View vagrant list
cd /project_root
vagrant init
[update Vagrantfile]
====================
config.vm.box_url = "http://files.vagrantup.com/lucid64.box"
config.vm.forward_port 80, 8080
config.vm.forward_port 8000, 8001
@mrahma01
mrahma01 / vim102012
Created Oct 15, 2012
vimrc aug 2012
View vim102012
let mapleader=","
call pathogen#infect()
filetype plugin indent on
" nerdtree
"autocmd VimEnter * NERDTree "load nerdtree while entering vim
nnoremap <silent> <leader>f :NERDTreeToggle<CR>
@mrahma01
mrahma01 / improved-handle.py
Created May 18, 2012 — forked from igniteflow/improved-handle.py
Modified handle for Django management commands that calls class methods based on the given args
View improved-handle.py
"""
This modified handle will dynamically call class methods using the first arg supplied after the management command.
For example:
./manage.py solr update
would look for the update function of the Command class of the solr.py management command. Any extra args given will be passed to the function
"""
def handle(self, *args, **options):
argument = args[0]
View gist:1327897
#Color table from: http://www.understudy.net/custom.html
fg_black=%{$'\e[0;30m'%}
fg_red=%{$'\e[0;31m'%}
fg_green=%{$'\e[0;32m'%}
fg_brown=%{$'\e[0;33m'%}
fg_blue=%{$'\e[0;34m'%}
fg_purple=%{$'\e[0;35m'%}
fg_cyan=%{$'\e[0;36m'%}
fg_lgray=%{$'\e[0;37m'%}
fg_dgray=%{$'\e[1;30m'%}
View clw.vimrc
set nocompatible " use vim defaults
set ls=2 " allways show status line
set tabstop=4 " numbers of spaces of tab character
"set expandtab " tabs are converted to spaces, use only when required
set shiftwidth=4 " numbers of spaces to (auto)indent
set showcmd " display incomplete commands
set hlsearch " highlight searches
set incsearch " do incremental searching
set ruler " show the cursor position all the time
"set number
View .gvimrc
set tabstop=4
set shiftwidth=4 "4 spaces for indenting
set ai "Auto indent
set si "Smart indet
set wrap "Wrap lines
set ch=1 " Make command line two lines high
set mousehide " Hide the mouse when typing text
let c_comment_strings=1
syntax on
set hlsearch "Highlight search things
View gist:672361
Last login: Thu Nov 11 11:14:31 on ttys003
AM2776:~ mrahma01$ cd Sites/radian6/
AM2776:radian6 mrahma01$ python
Python 2.6.6 (r266:84292, Sep 29 2010, 11:32:46)
[GCC 4.0.1 (Apple Inc. build 5493)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from connectapi import *
>>> return_topic('data/topicdata/recent/24/381/1,2,4,5,8,9,10,11,12,13,14,16/1/0?advancedFilters=0:235&keyphrases=bacardi||Bacardi')
'<?xml version="1.0" encoding="UTF-8"?><radian6_RiverOfNews_export><report_date>Thu Nov 11 07:15:52 AST 2010</report_date><user_name>social@iprospect.com</user_name><RoN_sort_order>publishedDate</RoN_sort_order><article_count>0</article_count><total_article_count>2039</total_article_count></radian6_RiverOfNews_export>'
>>> return_topic('data/topicdata/recent/24/381/1,2,4,5,8,9,10,11,12,13,14,16/1/0?advancedFilters=0:234&keyphrases=bacardi||Bacardi')
View gist:653764
<VirtualHost *:80>
ServerName local.iflatshare.com
DocumentRoot "/Users/mrahma01/Dev/cost_management"
<Directory /Users/mrahma01/Dev/cost_management>
AllowOverride All
</Directory>
Alias /media/ /Users/mrahma01/Dev/cost_management/media/
<Directory /Users/mrahma01/Dev/cost_management/media>
You can’t perform that action at this time.