Skip to content

Instantly share code, notes, and snippets.

View mdnurahmed's full-sized avatar

MD Nur Ahmed mdnurahmed

  • Dhaka , Bangladesh
View GitHub Profile
@mdnurahmed
mdnurahmed / fullcode.py
Created January 8, 2021 19:41
Full code
import csv
from collections import defaultdict
from datetime import datetime
import matplotlib.pyplot as plt
import numpy as np
def duration_to_seconds(duration):
elements = duration.split(':')
hour = int(elements[0])
min = int(elements[1])
@mdnurahmed
mdnurahmed / bar.py
Last active January 8, 2021 19:39
Generating the bar chart
import numpy as np
dates = []
mins = []
for i in range(0,len(mylist)):
dates.append(mylist[i][0])
mins.append(int(mylist[i][1]/60))
#xcordinates of the bars
xpos = np.arange(len(dates))
@mdnurahmed
mdnurahmed / date.py
Created January 8, 2021 19:16
Sorting by date
from datetime import datetime
def sortKey(val):
date = val[0]
#https://docs.python.org/3/library/datetime.html#strftime-strptime-behavior
return datetime.strptime(date, '%m/%d/%Y')
mylist = list(mydict.items())
mylist.sort(key = sortKey)
@mdnurahmed
mdnurahmed / read_csv.py
Created January 8, 2021 18:58
Reading and processing clockify csv file
import csv
from collections import defaultdict
def duration_to_seconds(duration):
elements = duration.split(':')
hour = int(elements[0])
min = int(elements[1])
sec = int(elements[2])
return hour*60*60 + min*60 + sec
@mdnurahmed
mdnurahmed / clockify.csv
Created January 8, 2021 18:42
csv file
We can make this file beautiful and searchable if this error is corrected: It looks like row 7 should actually have 16 columns, instead of 15. in line 6.
"Project","Client","Description","Task","User","Email","Tags","Billable","Start Date","Start Time","End Date","End Time","Duration (h)","Duration (decimal)","Billable Rate (USD)","Billable Amount (USD)"
"test","","test","","User","User@test.com","","Yes","01/07/2021","01:26:00 PM","01/07/2021","02:43:00 PM","01:17:00","1.28","0.00","0.00"
"test","","test","","User","User@test.com","","Yes","01/06/2021","10:11:00 AM","01/06/2021","01:26:00 PM","03:15:00","3.25","0.00","0.00"
"test","","test","","User","User@test.com","","Yes","01/05/2021","09:26:00 AM","01/05/2021","10:11:00 AM","00:45:00","0.75","0.00","0.00"
"test","","test","","User","User@test.com","","Yes","01/04/2021","07:41:00 AM","01/04/2021","09:26:00 AM","01:45:00","1.75","0.00","0.00"
"test","","test","","User","User@test.com","","Yes","01/03/2021","04:56:00 AM","01/03/2021","07:41:00 AM","02:45:00","2.75","0.00","0.00"
"test","","test","","User","User@test.com","","Yes","01/02/2021","02:26:00 AM","01/02/2021","04:56:00 AM","02:30:00","2.50","0.00"
@mdnurahmed
mdnurahmed / crawler3.go
Last active December 2, 2020 01:14
peculiar crawler - 3
package main
import (
"context"
"encoding/json"
"fmt"
"io/ioutil"
"log"
"net/http"
"sync"
@mdnurahmed
mdnurahmed / crawler2.go
Last active December 2, 2020 01:13
peculiar crawler - 2
package main
import (
"encoding/json"
"fmt"
"io/ioutil"
"log"
"net/http"
"sync"
"time"
@mdnurahmed
mdnurahmed / crawler1.go
Last active December 1, 2020 23:58
peculiar crawler - 1
package main
import (
"encoding/json"
"fmt"
"io/ioutil"
"log"
"net/http"
"sync"
"time"
@mdnurahmed
mdnurahmed / server.go
Last active December 2, 2020 00:53
It's dummy server for the "peculiar crawler" problem
package main
import (
"fmt"
"math/rand"
"net/http"
"time"
"github.com/gin-gonic/gin"
)