Skip to content

Instantly share code, notes, and snippets.

View darkopetrovic's full-sized avatar

Darko Petrovic darkopetrovic

  • HES-SO//Vs
  • Sion, Switzerland
View GitHub Profile
@darkopetrovic
darkopetrovic / br-generator.py
Created February 16, 2023 17:21
Generate a BR (Bischoff and Ratcliff) class instance for the Container Loading Problem (CLP)
import numpy as np
import pandas as pd
from scipy.stats import beta as beta_distribution
def ParkMillerRNG(seed, start, end):
"""Park and Miller Random Number Generator"""
m = 2**31 - 1
a = (end-start)/m
b = start
This file has been truncated, but you can view the full file.
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# IQ Measurements"
]
},
{
@darkopetrovic
darkopetrovic / prime_circle_cross
Last active August 29, 2015 14:19
The Prime Number Cross
{
"metadata": {
"name": "",
"signature": "sha256:614bf52063d113273a52054f6235b357b200120c8546564c4c6b6be5499f22da"
},
@darkopetrovic
darkopetrovic / gist:11292725
Created April 25, 2014 15:04
Datalog and stream light sensor and voltage reading from ADC with Raspberry PI to Plot.ly
#!/usr/bin/python
import os, time, signal, sys
from Adafruit_ADS1x15 import ADS1x15
import RPi.GPIO as GPIO
from datetime import datetime
import subprocess
import argparse
import requests
import json
@darkopetrovic
darkopetrovic / gist:7156541
Created October 25, 2013 15:28
Very simple Qwt dockable widget with PyQt.
from guidata.qt.QtGui import QWidget, QMainWindow, QVBoxLayout, qApp
from guidata.qtwidgets import DockableWidget
from guidata.qt.QtCore import Qt, QThread
from guiqwt.plot import CurveWidget, CurvePlot
from guiqwt.builder import make
from guiqwt.config import _
APP_NAME = _("Very simple Qwt dockable widget with PyQt")
class DockablePlotWidget( DockableWidget ):
@darkopetrovic
darkopetrovic / bluelink_bioharness.py
Created March 19, 2012 21:25
Python Bluetooth Link Example for the Zephyr BioHarness 3.0