Skip to content

Instantly share code, notes, and snippets.

View copyninja's full-sized avatar

Vasudev Kamath copyninja

View GitHub Profile
@copyninja
copyninja / dhvani_snippet3.py
Created March 26, 2011 08:17
Mapping of the functions from dhvani to python
# Define dhvani speech function
dhvani_say = dhvani.dhvani_say
dhvani_say.restype = c_int
dhvani_say.argtypes = [c_char_p,POINTER(dhvani_options)]
# dhvani_speak_file function
dhvani_speak_file = dhvani.dhvani_speak_file
dhvani_speak_file.restype = c_int
dhvani_speak_file.argtypes = [c_void_p,POINTER(dhvani_options)]
@copyninja
copyninja / dhvani_snippet2.py
Created March 26, 2011 07:52
dhvani_options structure
class dhvani_options(Structure):
_fields_ = [("voice",POINTER(dhvani_VOICE)),
("pitch",c_float),
("tempo",c_float),
("rate",c_int),
("language",c_int),
("output_file_format",c_int),
("isPhonetic",c_int),
("speech_to_file",c_int),
("output_file_name",c_char_p),
@copyninja
copyninja / dhvani_snippet1.py
Created March 26, 2011 06:16
Dhvani python coupling snippets
# dhvani_ERROR enum
(DHVANI_OK,DHVANI_INTERNAL_ERROR) = (0,-1)
# dhvani_output_file_format enum
(DHVANI_OGG_FORMAT,DHVANI_WAV_FORMAT) = (0,1)
# dhvani_Languages enum
(HINDI,MALAYALAM,TAMIL,KANNADA,
ORIYA,PANJABI,GUJARATI,TELUGU,
BENGALAI,MARATHI,PASHTO) = (1,2,3,4,5,6,7,8,9,10,11)
@copyninja
copyninja / gist:836035
Created February 20, 2011 15:12
rules file for pypdflib debian packaging
#!/usr/bin/make -f
# This file was automatically generated by stdeb 0.6.0 at
# Sun, 19 Dec 2010 13:13:23 +0530
# Unset the environment variables set by dpkg-buildpackage. (This is
# necessary because distutils is brittle with compiler/linker flags
# set. Specifically, packages using f2py will break without this.)
unexport CPPFLAGS
unexport CFLAGS
@copyninja
copyninja / count_chars_in_name.c
Created January 31, 2011 11:33
Counts the number of occurrences of each charachter in input word
/**************************************************************************************************************************/
/* count_char.c */
/* */
/* Copyright 2011 Vasudev Kamath <[email protected]> */
/* */
/* This program is free software; you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 3 of the License, or */
/* (at
@copyninja
copyninja / naruto_episode_link_fetcher.py
Created November 15, 2010 16:31
Script fetches Naruto Shippudden download links from animeshippuuden.com
@copyninja
copyninja / my_html_parser.py
Created October 22, 2010 11:44
Trying to write a html parser using python3 html.parser module with pyquery and lxml
#!/usr/local/bin/python3
import sys
from urllib.request import Request,urlopen
from urllib.error import URLError,HTTPError
from html.parser import HTMLParser,HTMLParseError
from pyquery import PyQuery as pq
class MyHTMLParser(HTMLParser):
"""
@copyninja
copyninja / gpl.yasnippet
Created October 20, 2010 11:07
Improved yasnippet to insert comment depending on the mode.
# -*- mode: snippet -*-
# name: gplc
# contributor: Vasudev Kamath <[email protected]>
# --
${1:`(buffer-name)`}
Copyright ${2:`(nth 5 (decode-time))`} ${3:`(user-full-name)`} ${4:<`(replace-regexp-in-string "@" "@" user-mail-address)`>}
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU ${5:$$(yas/choose-value '("Lesser" "Affero" ""))} General Public License as published by
@copyninja
copyninja / driver.py
Created October 19, 2010 11:39
Simple Driver program for Crawler
#!/usr/local/bin/python3
from crawler import Crawler
def crawling_done(url):
print(("Crawling {} done".format(url)))
if __name__ == "__main__":
c = Crawler(crawling_done,"http://kn.wikipedia.com/wiki/Karnataka","kn_IN")
c.crawl()
@copyninja
copyninja / crawler.py
Created October 19, 2010 11:38
A Simple Web crawler for getting words and links of a language from WWW
#!/usr/local/bin/python3
import re
import sqlite3
from urllib.request import urlopen,Request
from urllib.error import HTTPError
from multiprocessing import Process
# TODO Fill this table with other language regexps
lang_regexps = {