Skip to content

Instantly share code, notes, and snippets.

View santhoshtr's full-sized avatar
👷‍♂️
Work in progress

Santhosh Thottingal santhoshtr

👷‍♂️
Work in progress
View GitHub Profile
@santhoshtr
santhoshtr / render.py
Created October 9, 2014 09:12
PangoCairo Text rendering
#!/usr/bin/python
#-*- coding:utf8 -*-
import cairo
import pango
import pangocairo
surface = cairo.ImageSurface(cairo.FORMAT_ARGB32, 600, 100)
context = cairo.Context(surface)
pc = pangocairo.CairoContext(context)
@santhoshtr
santhoshtr / KeralaPRDHeadlinesCrawler.py
Created October 26, 2019 07:27
Crawl Kerala PRD website and download all content to json
import scrapy
from scrapy.http import Request
class HeadlineCatcher(scrapy.Spider):
name = "headlinecatcher"
start_urls = ["http://www.prd.kerala.gov.in/pressrelease"]
custom_settings = {
'FEED_EXPORT_ENCODING': 'utf-8',
}

Keybase proof

I hereby claim:

  • I am santhoshtr on github.
  • I am sthottingal (https://keybase.io/sthottingal) on keybase.
  • I have a public key ASAP_nrhFC103eL1sF9vFA9M4mrxkfvudZ2I-Bd9kiukOgo

To claim this, I am signing this object:

@santhoshtr
santhoshtr / Logger.js
Last active October 17, 2018 12:00
Winston based configurable node logger
var winston = require( 'winston' ),
fs = require( 'fs' ),
logDir = 'log', // Or read from a configuration
env = process.env.NODE_ENV || 'development',
logger;
winston.setLevels( winston.config.npm.levels );
winston.addColors( winston.config.npm.colors );
if ( !fs.existsSync( logDir ) ) {
@santhoshtr
santhoshtr / hd-playlist-audio-downloader.sh
Created July 9, 2018 11:23
HD Audio download from a youtube playlist
youtube-dl -f bestaudio --extract-audio --audio-format mp3 --audio-quality 0 -o "%(title)s.%(ext)s" https://www.youtube.com/playlist?list=abdlshfjskdhfuwhrklk
@santhoshtr
santhoshtr / ICUStingComparison.py
Created April 6, 2018 17:21
ICU based string comparison using various collation strengths
from icu import Locale, Collator as ICUCollator
import locale
collator = ICUCollator.createInstance(Locale("ml_IN"))
word1="അവൻ"
word2="അവ‍ന്\u200d" # "അവന്"
collator.setStrength(ICUCollator.PRIMARY);
print("[ICU] Are they primary equal? ", collator.compare(word1, word2))
collator.setStrength(ICUCollator.SECONDARY);
print("[ICU] Are they secondary equal? ", collator.compare(word1, word2))
@santhoshtr
santhoshtr / index.html
Created December 10, 2017 11:39
Malayalam number parser
<div class="container">
<input id="num" type="number" placeholder="Enter a number" />
<div id="result"></div>
<div id="analysis"></div>
</div>
@santhoshtr
santhoshtr / Collator.py
Last active September 18, 2017 04:40
Malayalam Collator
#!/usr/bin/python3
import sys
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk, Gio, GLib, Pango
import locale
from pyuca import Collator
from icu import UnicodeString, Locale, Collator as ICUCollator
@santhoshtr
santhoshtr / Malayalam-Syllable.peg
Last active May 27, 2017 11:26
Malayalam Syllable Model using PEG
Word = Syllable+
Syllable = s:( Vowel
/ Chillu
/ ( Conjunct / Consonant ) Signs
/ ZWNJ
) {
if ( Array.isArray( s ) ) {
return s.join( '' )
}
return s
@santhoshtr
santhoshtr / Malayalam-Conjunct.peg
Last active May 21, 2017 05:18
Malayalam Conjuct defined in Parser expression grammar
Conjunct = Consonant Virama (Conjunct / Consonant )
Consonant = [കഖഗഘങചഛജഝഞടഠഡഢണതഥദധനപഫബഭമയരലവശഷസഹളഴറ]
Virama = [്]