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 / himal.json
Created Apr 13, 2019
A JSON dump of ~4 months of Himal tweets
View himal.json
This file has been truncated, but you can view the full file.
[
{
"created_at": "Thu Nov 15 10:31:45 +0000 2018",
"id": 1063016696879824897,
"id_str": "1063016696879824897",
"text": "SLPP Muslims? Is that like Gestapo Jews?",
"truncated": false,
"entities": {
"hashtags": [],
@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'
View FB Insights
"Post ID",
Permalink,
"Post Message",
Type,
Countries,
Languages,
Posted,
"Lifetime Post Total Reach",
"Lifetime Post organic reach",
"Lifetime Post Paid Reach",
View docker-compose.yml
version: "2"
services:
webserver:
image: nginx:alpine
ports:
- "8000:80"
volumes:
- .:/var/www
- ./docker/nginx/site.conf:/etc/nginx/conf.d/default.conf
View site.conf
server {
listen 80;
index index.php index.html;
server_name localhost;
error_log /var/log/nginx/error.log;
access_log /var/log/nginx/access.log;
root /var/www;
location / {
try_files $uri $uri/ /index.php;
@janithl
janithl / version.go
Last active Oct 5, 2018
A simple Go utility for work, where we need to get the version of a site through its generator meta tag
View version.go
package main
import (
"bufio"
"fmt"
"io/ioutil"
"net/http"
"os"
"regexp"
"strconv"
@janithl
janithl / hello.go
Created Sep 3, 2018
HelloWorld in Go
View hello.go
package main
import "fmt"
import "time"
func main() {
fmt.Println("ආයුබෝවේවා, මහරජානනි.")
var t = time.Now()
fmt.Printf("දැන් වේලාව %02d:%02d\n", t.Hour(), t.Minute())
@janithl
janithl / goroutines.go
Created Sep 3, 2018
A simple Goroutine exercise, where a worker thread reads user input through a channel
View goroutines.go
package main
import (
"bufio"
"fmt"
"os"
"time"
)
type message struct {
@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
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):
You can’t perform that action at this time.