Skip to content

Instantly share code, notes, and snippets.

View nikolak's full-sized avatar

Nikola Kovacevic nikolak

View GitHub Profile
@nikolak
nikolak / events.json
Created November 7, 2014 11:42
Simple flask example that uses fullcalendar.io
[
{
"title": "All Day Event",
"start": "2014-09-01"
},
{
"title": "Long Event",
"start": "2014-09-07",
"end": "2014-09-10"
},
@nikolak
nikolak / res.py
Created October 24, 2014 19:11
Convert RES settings to chrome extension data from firefox settings and vice versa.
import os
import ConfigParser
import json
import sqlite3
import codecs
def _expand(path):
return os.path.expanduser(path)
@nikolak
nikolak / trakt_ep_to_sickrage.py
Last active August 29, 2015 14:07
Syncs all episodes from trakt.tv library to local sickrage database
import requests
import sqlite3
import os
'''
Status ID's:
1 = not aired
3 = wanted
5 = skipped
@nikolak
nikolak / trakt_to_sickrage.py
Last active October 1, 2016 22:46
Get all shows from your trakt.tv library and add them to sickrage database
import requests
import sqlite3
import os
# API key available at: http://trakt.tv/api-docs/authentication
API_KEY = "25665d450ed0c00907f32be617cd2a37"
TRAKT_USER = "nikolak" # trakt username
TRAKT_URL = "http://api.trakt.tv/user/library/shows/all.json/{key}/{user}".format(
key=API_KEY,
user=TRAKT_USER)
def quicksort(array):
if len(array) <= 1:
return array
pivot = array[0]
array.remove(pivot)
less, greater = [], []
for x in array:
if x <= pivot:
less.append(x)
else:
@nikolak
nikolak / trakt.py
Created June 1, 2014 15:19
Show a list of shows that are in user library that air in the next 7 days
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2014 Nikola Kovacevic <nikola@nikolak.com>
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
import os
import sys
from PySide import QtGui, QtCore
class MainWindow(QtGui.QMainWindow):
def __init__(self):
super(MainWindow, self).__init__()
self.showFullScreen()
import datetime
import time
alarm = datetime.datetime(2014, month, day, hour, minute)
while True:
now = datetime.datetime.now()
diff = alarm - now
if diff.total_seconds() < 0:
print "Alarm triggered"
break
@nikolak
nikolak / tk_search.py
Last active February 7, 2024 12:52
Filter tkinter listbox using Entry, StringVar and trace.
from Tkinter import *
# First create application class
class Application(Frame):
def __init__(self, master=None):
Frame.__init__(self, master)
@nikolak
nikolak / gist:8765020
Created February 2, 2014 09:04
Make a dictionary with subreddits as keys and values as upvotes and downvotes in that subreddit, works for last ~1000 comments
#!/usr/bin/env python
import sys
import json
import time
import urllib
import httplib2
from urllib import urlencode
from urlparse import urlparse, urlunparse, parse_qs