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
from twisted.web import proxy, http
from twisted.internet import reactor
from twisted.python import log
import sys
log.startLogging(sys.stdout)
class ProxyFactory(http.HTTPFactory):
protocol = proxy.Proxy
reactor.listenTCP(9898, ProxyFactory())
@santhoshtr
santhoshtr / RachanaKathiru.diff
Created November 10, 2014 04:16
RachanaKathiru.diff
Rachana Kathiru
============= ===============
# GDEF Mark Attachment Classes # GDEF Mark Attachment Classes
# GSUB # GSUB
@santhoshtr
santhoshtr / font-play.sh
Created November 3, 2014 15:51
Create GIF animation from the rendering of a text through the history of development
#!/bin/bash
git rev-list --reverse master > revlist.txt
git checkout -f master
rm -rf images
rm Chilanka.ttf
mkdir images
COUNTER=0
while read commit
do
git checkout -f "$commit"
@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 / 3in1.js
Created September 24, 2014 04:40
3in1.js inputmethods by Hrishi
/*<----------------------------3in1.js Code Starts Here------------------------------------------>*/
/*
* Implementation of Malayalam Inscript,Mozhi,and Swanlekha Schemes in Javascript.
* Copyright 2010, Hrishikesh K B <hrishi.kb@gmail.com>
*
* Based on the swanalekha javascript code by Santhosh Thottingal and Nishan Naseer.
* and the Mozhi javascript code by Peringz
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
@santhoshtr
santhoshtr / record-window-gif.sh
Created September 19, 2014 04:59
Record a window as GIF using byzanz
#!/bin/bash
# Delay before starting
DELAY=10
# Sound notification to let one know when recording is about to start (and ends)
beep() {
paplay /usr/share/sounds/KDE-Im-Irc-Event.ogg &
}
@santhoshtr
santhoshtr / example.tex
Last active November 6, 2021 06:14
Simple XeTeX example for Malayalam typesetting
\documentclass[11pt]{article}
\usepackage{fontspec}
\usepackage{polyglossia}
\setdefaultlanguage{malayalam}
\setmainfont[Script=Malayalam, HyphenChar="00AD]{Rachana}
% In the above line we customized Hyphenation characters since
% visbile hyphen, aka Soft Hyphen is not used for Malayalam
\setlanghyphenmins{malayalam}{3}{4}
\linespread{1.2}
\widowpenalty=10000
@santhoshtr
santhoshtr / cldr-example.js
Last active August 29, 2015 14:01
CLDRPluralRuleParser example
var parser = require(__dirname + '/CLDRPluralRuleParser.js');
var rule = 'v = 0 and n != 0..10 and n % 10 = 0';
var result = parser(rule, 20);
console.log(result);
//outputs true
@santhoshtr
santhoshtr / twitter-cldr-rules-russinan.js
Created May 24, 2014 10:03
CLDR Plural rules converted to javascript function
PluralRules.rules = {
"keys": ["one", "few", "many", "other"],
"rule": function (n) {
return (function () {
if (n % 10 == 1 && !(n % 100 == 11)) {
return "one"
} else {
return (function () {
if ([2, 3, 4].indexOf(n % 10) >= 0 && !([12, 13, 14].indexOf(n % 100) >= 0)) {
return "few"
@santhoshtr
santhoshtr / russian-plural-rules.xml
Last active August 29, 2015 14:01
Russian plural rules as per CLDR 23
<pluralRules locales="ru uk">
<pluralRule count="one">v = 0 and i % 10 = 1 and i % 100 != 11 @integer 1, 21, 31, 41, 51, 61, 71, 81, 101, 1001, …</pluralRule>
<pluralRule count="few">v = 0 and i % 10 = 2..4 and i % 100 != 12..14 @integer 2~4, 22~24, 32~34, 42~44, 52~54, 62, 102, 1002, …</pluralRule>
<pluralRule count="many">v = 0 and i % 10 = 0 or v = 0 and i % 10 = 5..9 or v = 0 and i % 100 = 11..14 @integer 0, 5~19, 100, 1000, 10000, 100000, 1000000, …</pluralRule>
<pluralRule count="other"> @decimal 0.0~1.5, 10.0, 100.0, 1000.0, 10000.0, 100000.0, 1000000.0, …</pluralRule>
</pluralRules>