Skip to content

Instantly share code, notes, and snippets.

View nikolak's full-sized avatar

Nikola Kovacevic nikolak

View GitHub Profile
from time import time, sleep
import requests
import logging
import json
# submission dict layout initial idea
# {"id": {
# time:{ #unix timestamp, str
import sys
import sqlite3
import datetime
#TO-DO:
#Fix a few user options...I think like 1-3 or something.
#
conn = sqlite3.connect('moviedb.db')
c = conn.cursor()
class Movie(object):
@nikolak
nikolak / gist:8403499
Last active January 3, 2016 03:39
Gets all items possible from entered reddit pages following the &after= param
#!/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
@nikolak
nikolak / gist:8499032
Created January 19, 2014 01:02
Gets number of currently online friends on facebook
import webbrowser
import os
import urllib2
import json
import urllib
from time import strftime, sleep
def write_to_file(data):
if os.path.exists("fb_data.txt"):
with open("fb_data.txt","a") as out_file:
@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
@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)
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
import os
import sys
from PySide import QtGui, QtCore
class MainWindow(QtGui.QMainWindow):
def __init__(self):
super(MainWindow, self).__init__()
self.showFullScreen()
@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
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: