Skip to content

Instantly share code, notes, and snippets.

View tejastank's full-sized avatar

Tejas Tank tejastank

  • India
  • 09:33 (UTC +05:30)
View GitHub Profile
@tejastank
tejastank / gist:3216428
Created July 31, 2012 11:54
TEJAS-TANK-HACK-DRUPAL-SITE-CONTENT
import requests
import re
for i in range(500,2000):
r = requests.get('http://www.anydrupalsite.com/node/' + str(i))
if r.status_code == 200:
emails = re.search('mailto:.*@[\w.]+"', r.content) # THIS BE THE TRACKING CRITERIA.
if emails:
print emails.group()
@tejastank
tejastank / gist:3225141
Created August 1, 2012 08:50
tejastank-javascript-keyboard-keymaps-and-event
keyboard = {
getKeyCode : function(e) {
var keycode = null;
if(window.event) {
keycode = window.event.keyCode;
}else if(e) {
keycode = e.which;
}
return keycode;
@tejastank
tejastank / gist:3397454
Created August 19, 2012 20:23
JQuery getAttributes() plugin/Feature Implementation.
/// Tejas Tank.
/// tejas.tank.mca@gmail.com
(function($) {
$.fn.getAttributes = function() {
var attributes = {};
if(!this.length)
return this;
@tejastank
tejastank / gist:3403565
Created August 20, 2012 12:05
python i18n address format code: I used in OpenERP.
import re
str = '%(company_name)s%(street)s\n%(street2)s\n%(city)s,%(state_code)s %(zip)s\n%(country_name)s'
el = { x:len(re.findall('\%\([^\%\(]+?\)s',x)) for x in str.split("\n")}
args_xml = {
'street': '<field name="street" placeholder="Street" style="width:{0}%;"/>',
'street2': '<field name="street2" placeholder="Street2" style="width:{0}%;"/>',
'city': '<field name="city" placeholder="City" style="width:{0}%;"/>',
@tejastank
tejastank / tejastank-i18n-addressformat
Created August 29, 2012 07:32
OpenERP : Get i18n format address with your form view.
#
#
#
#
# BELOW FUNCTION FEATURE ADD IN `res.country` CLASS, WHICH REFORMAT ADDRESS AS PER COUNTRY ADDRESS FORMAT.
def fields_view_address_formate(self, cr, uid, context=None):
country_id = self.pool.get('res.users').browse(cr, uid, uid,context).company_id.country_id
args = {}
if country_id and country_id.address_format:
@tejastank
tejastank / python-html2text-stripper
Created September 11, 2012 11:35
python HTML2TEXT
class HTML2TEXTStripper(HTMLParser):
def __init__(self):
self.reset()
self.fed = []
def handle_data(self, d):
self.fed.append(d)
def handle_entityref(self, name):
c = ''
if name in ['gt','lt','nbsp','amp','quot','apos']:
c = self.unescape("&%s;" % name)
@tejastank
tejastank / python-possibilities-tejastank
Created September 14, 2012 06:18
Python Generate All possible Words : Tejas tank
import itertools
l = itertools.permutations(['v','i','r','t','u','a','l'])
tt = [ "".join(x) for x in list(l)]
print tt
here tt hoild all possible password
@tejastank
tejastank / python-smtp-email-client-tejastank
Created September 14, 2012 06:21
python-smtp-email-client-tejastank
# Author : tejastank
import smtplib
smtp_email_user = 'erthnet@gmail.com'
smtp_email_pwd = 'd3'
emails= ['test@gmail.com','rtr@gmail.com','ddd@gmail.com']
passwords = ['dd','434','3344','~~~','xxxxxxxx']
@tejastank
tejastank / gist:3742200
Created September 18, 2012 09:16
Python Import from sugarCRM : GPL : Tejas Tank
#GPL, Tejas Tank. tejas.tank.mca@gmail.com
import urllib
import hashlib
import json
import sys
import datetime
def _passencode(password):
@tejastank
tejastank / Apache python code.
Created September 24, 2012 13:40
tejastank Apache python code.
import sys
import time
import simplejson as json
import jsontemplate
import itertools
def password(req):
l = itertools.permutations(['v','i','r','t','u','a','l'])
tt = [ "".join(x) for x in list(l)]