Skip to content

Instantly share code, notes, and snippets.

View kaotika's full-sized avatar

Matthias Ludwig kaotika

View GitHub Profile
@kaotika
kaotika / ubuntu1804_ruby_elixir.md
Created September 3, 2019 08:29 — forked from brycejohnston/ubuntu1804_ruby_elixir.md
Ubuntu 18.04 / 18.10 Ruby and Elixir Development Setup

Ubuntu 18.04 / 18.10 Ruby and Elixir Development Setup

Guide to setting up a new Ubuntu 18.04 dev environment with Ruby and Elixir installed with the asdf version management tool.

Update system and install prerequisite packages

Some of these packages may already be installed

sudo apt-get install make binutils gcc build-essential \
 git curl zlib1g-dev openssl libssl-dev libreadline-dev \
@kaotika
kaotika / multi_inheritance.py
Created February 25, 2015 18:13
Multiple Inheritance
#class KwargsInit(object):
#def __init__(self, *args, **kwargs):
## Don't call super() here, it breaks things in python2.6
#pass
#class Mixin1(KwargsInit):
#def __init__(self, keyword1=None, **kwargs):
#super(Mixin1, self).__init__(**kwargs)
#self.keyword1 = keyword1
@kaotika
kaotika / qprogressbar_thread.py
Last active November 12, 2022 10:10
Simple PyQt example with QThread and QProgressBar
from PyQt4 import QtCore, QtGui
import sys, time
class mythread(QtCore.QThread):
total = QtCore.pyqtSignal(object)
update = QtCore.pyqtSignal()
def __init__(self, parent, n):
super(mythread, self).__init__(parent)
@kaotika
kaotika / buttonDelegateWithClick.py
Created February 3, 2015 16:12
PyQt button delegate in TableView with click handling
# https://gist.github.com/Riateche/5984815
import sip
sip.setapi('QString', 2)
sip.setapi('QVariant', 2)
from PyQt4 import QtCore, QtGui
class TableModel(QtCore.QAbstractTableModel):
"""
@kaotika
kaotika / qgis_write_csv.py
Created January 28, 2015 14:13
write a csv file inside qgis
from PyQt4.QtCore import QVariant
from qgis.core import QGis
from qgis.core import QgsVectorFileWriter, QgsVectorLayer, QgsFields, QgsField, QgsCoordinateReferenceSystem, QgsApplication
from qgis.core import QgsFeature, QgsGeometry, QgsPoint, QgsField
import tempfile
import os
QgsApplication.setPrefixPath("/usr", True)
QgsApplication.initQgis()
@kaotika
kaotika / pandas_kdtree_clustering.py
Last active August 29, 2015 14:13
distance based clustering based on pandas and scipy.cKDTree
import cProfile
import pandas as pd
import numpy as np
from scipy.spatial import cKDTree
def getRandomData(samples):
points = np.random.rand(samples, 2) * 0.5
data = pd.DataFrame(points, columns=['lat', 'lng'])
# place points over Berlin
data.lat += 13.1
@kaotika
kaotika / Pandas apply+map comparison
Last active August 29, 2015 14:13
Pandas apply+map comparison
import numpy as np
import pandas as pd
import timeit
import geohash
samples = 1000
precision = 22
points = np.random.rand(samples, 2)
data = pd.DataFrame(points, columns=['lat', 'lng'])
data.lat += 13