Skip to content

Instantly share code, notes, and snippets.

Nikola Kovacevic nikolak

Block or report user

Report or block nikolak

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 keybase.md

Keybase proof

I hereby claim:

  • I am nikolak on github.
  • I am nikolak (https://keybase.io/nikolak) on keybase.
  • I have a public key ASC9G0Rq2SdgijiTJHr6QaVr3mrkUJjbUKvumzIyNuxeoAo

To claim this, I am signing this object:

View airpods.py
def check_for_airpods(timeout=60):
import time;import os;import requests;import arrow
while True:
status = requests.get("https://www.apple.com/de/shop/retail/pickup-message?parts.0=MMEF2ZM%2FA&location=81925").json()['body']['stores'][0]['partsAvailability']['MMEF2ZM/A']['storePickupQuote']
available = 'Aug im' not in status
if available:
os.system(""" osascript -e 'display notification "{}" with title "Apple Store AirPods"'""".format(status))
else:
print(f"Last checked at {arrow.now().format('YYYY-MM-DD HH:mm')}, status= {status}", end="\r")
time.sleep(timeout)
View letter_counter.py
def letter_count(s):
counter, max_index = 1, len(s) - 1
out = []
for index, letter in enumerate(s):
if index < max_index:
if letter == s[index + 1]:
counter += 1
continue
View design.py
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'threading_design.ui'
#
# Created: Thu Aug 6 13:47:18 2015
# by: PyQt4 UI code generator 4.10.4
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
@nikolak
nikolak / threading_design.ui
Created Aug 5, 2015
Qt Designer files for http://nikolak.com/ tutorial [insert tutorial link here]
View threading_design.ui
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>MainWindow</class>
<widget class="QMainWindow" name="MainWindow">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>526</width>
<height>373</height>
View m.md

General

  • Django 1.7 EOL ~1yr after product release (1.8 is LTS) - migration should be easy docs
  • Testing - planned? Core features should be covered before release.
  • Moving controllers into their own apps?
  • Performance overhead by generating new dicts all the time? Maybe stroing json or using serialization? docs
  • Approach the communication between frontend and backend as a RESTful API that it is. Create API specs and docs. Suggestion: http://swagger.io/ some tool overview

Code

View design.py
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'design.ui'
#
# Created: Wed May 27 16:39:17 2015
# by: PyQt4 UI code generator 4.11.3
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
@nikolak
nikolak / craigslist_login.py
Last active Jul 18, 2016
Basic login to craigslist using python
View craigslist_login.py
import requests
# Some headers may bbe omitted, but IMO it's best to keep these:
headers = {"User-Agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.90 Safari/537.36",
"Host": "accounts.craigslist.org",
"Origin": "https://accounts.craigslist.org",
"Referer": "https://accounts.craigslist.org/login"}
# form POST data
View README.md

Introduction

  • This script lets you set up and use a temporary DigitalOcean droplet to download torrent files.
  • Once downloaded, they can be streamed down to your local machine.
  • This uses transmission-cli for the torrent client, and nginx to serve files.

Setup on Local Machine

  • This assumes that you have a DigitalOcean account and tugboat set up, as well as seedbox-setup.sh present in the current directory.
@nikolak
nikolak / events.json
Created Nov 7, 2014
Simple flask example that uses fullcalendar.io
View events.json
[
{
"title": "All Day Event",
"start": "2014-09-01"
},
{
"title": "Long Event",
"start": "2014-09-07",
"end": "2014-09-10"
},
You can’t perform that action at this time.