Skip to content

Instantly share code, notes, and snippets.

Janith Leanage janithl

Block or report user

Report or block janithl

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@janithl
janithl / feed.php
Last active Apr 4, 2019
PHP script for turning your Google+ feeds into valid RSS. You need to edit a couple of places but I'm sure you're smart enough to figure that out... :)
View feed.php
<?php
header('Content-type: text/xml');
$gendate = date('r', time());
$config = array(
'gplusid' => '116783522121096138585',
'gplusname' => 'Janith Leanage',
'hosturl' => 'http://janith.vacau.com/gplus'
@janithl
janithl / timer.c
Created Mar 23, 2012
Silly little C code I wrote to record the time I spent doing past paper questions. Not technically sound or anything, but it works for me. :P
View timer.c
/*
Silly program to lap time and stuff, by Janith Leanage.
Uses signal handling code. :P
*/
#include<stdio.h>
#include<signal.h>
int count[100];
int c = 0;
@janithl
janithl / Obstang.xml
Created Aug 30, 2012
Gedit theme, a cross between Vim's mustang and Gedit's Oblivion
View Obstang.xml
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (C) 2012
Author: Bernhard Posselt <bernhard.posselt@gmx.at>
Henrique C. Alves <hcarvalhoalves@gmail.com>
Janith Leanage
This file is free software; you can redistribute it and/or
@janithl
janithl / subreddit.css
Created Mar 7, 2015
Old /r/srilanka stylesheet
View subreddit.css
/* New Style Beta Header */
#header{background-image:url(%%disp3%%);height:110px;background-color:#540f12;background-repeat:no-repeat;background-position:right;border-bottom:3px solid #f8c221}
.user a,.separator,.pref-lang,.logout a{color:#fff}
#header-bottom-right{background:none}
#header-bottom-left{position:absolute;bottom:0}
.tabmenu li{display:inherit}
.tabmenu li a{font-size:20px;font-weight:100;color:#fff;background:none;border:none;}
.tabmenu li.selected a{background:none;border:none;}
.formtab li{display:inline; padding-left:0;}
.formtab li a{font-size:100% !important;font-weight:100;color: #369 !important;background:none;border:none;}
@janithl
janithl / sinhala.js
Created Oct 19, 2015
The Sinhala Object for transliterating Latin <-> Sinhala
View sinhala.js
/**
* Sinhala transliterator class
* Based on the UCSC Real Time Unicode Converter
* http://www.ucsc.cmb.ac.lk/ltrl/services/feconverter/t1.html
The MIT License (MIT)
Copyright (c) 2014 Janith Leanage
Permission is hereby granted, free of charge, to any person obtaining a copy
View FB Insights
"Post ID",
Permalink,
"Post Message",
Type,
Countries,
Languages,
Posted,
"Lifetime Post Total Reach",
"Lifetime Post organic reach",
"Lifetime Post Paid Reach",
@janithl
janithl / unp.csv
Created Sep 11, 2016
UNP general election electoral numbers, 1947 - 2015
View unp.csv
Election Leader Valid Votes Votes Won % Votes Total Seats Seats Won % Seats W/L Diff
1947 D. S. Senanayake 1887364 751432 39.81 95 42 44.21 W 4.40
1952 Dudley Senanayake 2327626 1026005 44.08 95 54 56.84 W 12.76
1956 John Kotelawala 2647247 738810 27.91 95 8 8.42 L 19.49
March 1960 Dudley Senanayake 3041420 909043 29.89 151 50 33.11 W 3.22
July 1960 Dudley Senanayake 3076869 1144166 37.19 151 30 19.87 L 17.32
1965 Dudley Senanayake 4046720 1590929 39.31 151 66 43.71 W 4.39
1970 Dudley Senanayake 4991798 1892525 37.91 151 17 11.26 L 26.65
1977 J. R. Jayewardene 6243573 3179221 50.92 168 140 83.33 W 32.41
1989 R. Premadasa 5596468 2838005 50.71 225 125 55.56 W 4.84
View getlang.py
from collections import defaultdict
UNICODE_BLOCKS = {
'en': range(0x0000, 0x02AF),
'si': range(0x0D80, 0x0DFF),
'ta': range(0x0B80, 0x0BFF),
'dv': range(0x0780, 0x07BF)
}
def getlang(text):
View testlang.py
import unittest
from getlang import getlang
class TestLang(unittest.TestCase):
"""Tests for `getlang.py`."""
def test_is_english(self):
self.assertTrue(getlang('hello') == 'en')
self.assertTrue(getlang('<2323$(@*(*&^&@^#>e') == 'en')
self.assertTrue(getlang('a') == 'en')
@janithl
janithl / httpClient.go
Created Sep 3, 2018
Simple client that HTTP gets and JSON parses an endpoint
View httpClient.go
package main
import "net/http"
import "fmt"
import "io/ioutil"
import "encoding/json"
// Artist is a struct to hold artist values
type Artist struct {
Name, Shortname, Reknown, Bio string
You can’t perform that action at this time.