Skip to content

Instantly share code, notes, and snippets.

Avatar

Janith Leanage janithl

View GitHub Profile
@janithl
janithl / timeline.svg
Last active May 17, 2020
Timeline of US late night shows on the 3 major networks. This file is released under a CC0 license: https://creativecommons.org/share-your-work/public-domain/cc0/
View timeline.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View versioncheck.go
package main
import (
"encoding/json"
"io/ioutil"
"net/http"
"os"
"regexp"
"time"
)
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
You can’t perform that action at this time.