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
View itemlist.json
[{
"id": 1,
"name": "Grape Soda Lupine"
}, {
"id": 2,
"name": "Pseudoleskeella Moss"
}, {
"id": 3,
"name": "Rosette Lichen"
}, {
@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": [],
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;
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
@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 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')
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.