Skip to content

Instantly share code, notes, and snippets.

View tejastank's full-sized avatar

Tejas Tank tejastank

  • India
View GitHub Profile
@tejastank
tejastank / raw data mapping
Created September 26, 2012 07:09
raw data mapping
data = {0x00000000 : "\x00", 0x00000001 : "\x01", 0x00000002 : "\x02", 0x00000003 : "\x03", 0x00000004 : "\x04", 0x00000005 : "\x05", 0x00000006 : "\x06", 0x00000007 : "\x07", 0x00000008 : "\x08", 0x00000009 : "\x09", 0x0000000a : "\x0a", 0x0000000b : "\x0b", 0x0000000c : "\x0c", 0x0000000d : "\x0d", 0x0000000e : "\x0e", 0x0000000f : "\x0f", 0x00000010 : "\x10", 0x00000011 : "\x11", 0x00000012 : "\x12", 0x00000013 : "\x13", 0x00000014 : "\x14", 0x00000015 : "\x15", 0x00000016 : "\x16", 0x00000017 : "\x17", 0x00000018 : "\x18", 0x00000019 : "\x19", 0x0000001a : "\x1a", 0x0000001b : "\x1b", 0x0000001c : "\x1c", 0x0000001d : "\x1d", 0x0000001e : "\x1e", 0x0000001f : "\x1f", 0x00000020 : "\x20", 0x00000021 : "\x21", 0x00000022 : "\x22", 0x00000023 : "\x23", 0x00000024 : "\x24", 0x00000025 : "\x25", 0x00000026 : "\x26", 0x00000027 : "\x27", 0x00000028 : "\
@tejastank
tejastank / python packet sniffer code
Created September 26, 2012 08:09
python packet sniffer code
# [email protected] , Packet sniffer code.
import dpkt, pcap
pc = pcap.pcap()
pc.setfilter('udp')
print "Device Name:", pc.name, "|Filter:",pc.filter
for ts, pkt in pc:
eth = dpkt.ethernet.Ethernet(pkt)
print eth.dst, eth.src, eth.pack_hdr
@tejastank
tejastank / gist:3835596
Created October 4, 2012 18:47 — forked from philsturgeon/gist:1529194
PyroCMS Example Module details.php
<?php defined('BASEPATH') or exit('No direct script access allowed');
class Module_Sample extends Module {
public $version = '2.0';
public function info()
{
return array(
'name' => array(
@tejastank
tejastank / video.php
Created October 4, 2012 18:57 — forked from mrkodssldrf/video.php
PyroCMS Video Plugin
<?php
/**
* Video Plugin
*
* Plugin to fetch Videos from various Sites
*
* youtube: {{video:youtube id="youtubeid"}}
* vimeo: {{video:vimeo id="vimeoid"}}
*
@tejastank
tejastank / openerp-sugarcrm-fixed-unicode-error
Created October 9, 2012 12:59
openerp-sugarcrm-fixed-unicode-error
=== modified file 'import_sugarcrm/sugar.py'
--- import_sugarcrm/sugar.py 2011-12-19 16:54:40 +0000
+++ import_sugarcrm/sugar.py 2012-09-17 07:30:01 +0000
@@ -171,7 +171,7 @@
for i in list:
ans_dir = {}
for j in i._name_value_list:
- ans_dir[tools.ustr(j._name)] = import_sugarcrm.unescape_htmlentities(tools.ustr(j._value))
+ ans_dir[tools.ustr(j._name)] = import_sugarcrm.unescape_htmlentities(tools.ustr(j._value, 'utf-8', 'replace'))
#end for
@tejastank
tejastank / gist:3889586
Created October 14, 2012 19:35
rpc server
<?php
require_once('RPCServer.class.php');
$server = RPCServer::getInstance(); //note that the RPCServer class is a singleton
function ourTime($args) {
return date('H:i:s');
}
function addSum($args) {
@tejastank
tejastank / gist:3889588
Created October 14, 2012 19:36
rpc client
var url = 'http://localhost/services.php' ;
var service;
try{
service = new rpc.ServiceProxy( url , {
asynchronous: false, //default: true , false mean syncronous.
sanitize: true, //default: true
methods: ['addSum'], //default: null (synchronous)
@tejastank
tejastank / python_check_EAN14
Created October 16, 2012 07:16
python check EAN14
def check_ean14(eancode):
if not eancode:
return True
if len(eancode) <> 14:
return False
try:
int(eancode)
except:
return False
oddsum=0
@tejastank
tejastank / TejasTank-Dynamic-PHP-Class-calls.php
Created October 23, 2012 10:13
Dynamic PHP Class calls & behaviours.
<?php
class MyClass
{
function test($t, $d)
{
echo "#####################", $t, $d;
}
}
$toRun = 'MyClass';
@tejastank
tejastank / openerp7-web-subdomain-configuration.patch
Created November 1, 2012 13:03
openerp7-web-subdomain-configuration
=== modified file 'addons/web/static/src/js/chrome.js'
--- addons/web/static/src/js/chrome.js 2012-10-23 12:28:33 +0000
+++ addons/web/static/src/js/chrome.js 2012-11-01 12:41:42 +0000
@@ -149,7 +149,7 @@
this.$buttons = this.$el.dialog("widget").find(".ui-dialog-buttonpane");
}
this.dialog_inited = true;
- var res = this.start();
+ var res = this.start();
return res;