Skip to content

Instantly share code, notes, and snippets.

Avatar

Goran Skoljarev gskoljarev

View GitHub Profile
@gskoljarev
gskoljarev / split.sh
Created Jul 19, 2018
Split .flac files via .cue file
View split.sh
shnsplit -f file.cue -t %n-%t -o flac file.flac
@gskoljarev
gskoljarev / raw_as_qs.py
Last active Mar 22, 2017 — forked from carymrobbins/raw_as_qs.py
Django - Execute a raw query and return a QuerySet
View raw_as_qs.py
from django.db import connection, models
class MyManager(models.Manager):
def raw_as_qs(self, raw_query, params=()):
"""Execute a raw query and return a QuerySet. The first column in the
result set must be the id field for the model.
:type raw_query: str | unicode
:type params: tuple[T] | dict[str | unicode, T]
:rtype: django.db.models.query.QuerySet
"""
@gskoljarev
gskoljarev / ramerdouglaspeucker.py
Last active Jun 13, 2020
Python implementation of Ramer-Douglas-Peucker (RDP) algorithm; ported from JavaScript code at https://gist.github.com/msbarry/9152218; uses desired number of points instead of using a threshold.
View ramerdouglaspeucker.py
# -*- coding: utf-8 -*-
import math
import time
def timenow():
return int(time.time() * 1000)
def sqr(x):