Skip to content

Instantly share code, notes, and snippets.

@symroc
symroc / lwi.h
Created August 10, 2020 21:55
How To subclass QListWidgetItem
#ifndef LWI_H
#define LWI_H
#include <QListWidgetItem>
#include <QListWidget>
#include <QString>
#include "f2t.h"
class lwi : public QListWidgetItem {
public:
@symroc
symroc / ReadBinary.cpp
Created August 10, 2020 21:59
How to read binary float(double) using STL only
#include <stdlib.h>
#include <stdio.h>
#include <vector>
#include <string>
std::string current="your file here";
std::ifstream infile;
std::vector<float> n;
std::vector<std::vector<float>> nums;
@symroc
symroc / byteArray2number.cpp
Last active July 7, 2022 15:29
Convert QByteArray to QVector<float>
#include<QByteArray>
#include<QVector>
#include<QDataStream>
QByteArray data;
QDataStream in (data);
in.setByteOrder(QDataStream::LittleEndian);
QVector<float> nums;
while(!in.atEnd()){
float f;
@symroc
symroc / cartesian.cpp
Last active September 15, 2020 16:13
Enhanced Libreplot cartesian Example (Can update data via TCP protocol or COM port)
/*
* This file is part of libreplot.
* Copyright (C) 2014-2016 Kuldeep Singh Dhaka <kuldeep@madresistor.com>
*
* libreplot is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* libreplot is distributed in the hope that it will be useful,
@symroc
symroc / cartesianLocal.cpp
Created September 15, 2020 16:16
Plot Data choosing local file. Based on libreplot
/*
* This file is part of libreplot.
* Copyright (C) 2014-2016 Kuldeep Singh Dhaka <kuldeep@madresistor.com>
*
* libreplot is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* libreplot is distributed in the hope that it will be useful,
@symroc
symroc / plot.py
Created September 29, 2020 20:48
pyqtgraph triaxial plot
class TimeAxisItem(pg.AxisItem):
def tickStrings(self, values, scale, spacing):
return [datetime.fromtimestamp(value) for value in values]
class PlotterDate():
def __init__(self, data, starttime,size=(1280,720)):
@symroc
symroc / read_kml.py
Created October 14, 2020 21:24
Read Google Eearth's kml(or kmz file converted to kml)
from bs4 import BeautifulSoup
import pandas as pd
import numpy as np
def remove_html_tags(text):
"""Remove html tags from a string"""
import re
clean = re.compile('<.*?>')
return re.sub(clean, '', text)