Skip to content

Instantly share code, notes, and snippets.

View minorsecond's full-sized avatar

Robert Ross Wardrup minorsecond

View GitHub Profile
#############################################################
# #
# Configuration file for Dire Wolf #
# #
# Macintosh version #
# #
#############################################################
#
# Consult the User Guide for more details on configuration options.
#
@minorsecond
minorsecond / datesorter.cpp
Last active June 17, 2021 23:02
date sorter
bool Database::compare_date(const Drink &a, const Drink &b) {
/*
* Determine if second date is greater than the first date.
* @param a: Date from a struct in YYYY-MM-DD format
* @param b: Date from b struct in YYYY-MM-DD format
* @return: True if second date is more recent than the first date. Else, false.
*/
int a_year = std::stoi(a.date.substr(0, 4));
int a_month = std::stoi(a.date.substr(5, 7));
#include <QStandardPaths>
#include <sys/stat.h>
#include <sys/types.h>
QString GetConfPath() {
// Get configuration path for MacOS.
std::string directory = QStandardPaths::standardLocations(QStandardPaths::AppDataLocation).at(0).toStdString();
std::string conf_path = directory + "/QtTermTCP.ini";
mkdir(directory.c_str(), 0775);
@minorsecond
minorsecond / sysinfo.py
Created January 30, 2021 23:50
System Info for BPQ32 Reporting
#!/bin/python
# Get sysinfo and print for BPQ reporting
import os
import time
import platform
import distro
import cpuinfo
import psutil
import uptime
@minorsecond
minorsecond / CMakeLists.txt
Created September 8, 2020 15:56
CMakeLists for macOS App Bundle
cmake_minimum_required(VERSION 3.17)
project(foo)
set(CMAKE_CXX_STANDARD 20)
set(LIBPROC_SRC "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/libproc.h")
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC ON)
def euclidian(a, b):
"""
Calculate distance between points on 2d surface
:param a: a list of coordinates for point a
:param b: a list of coordinates for point b
:return: distance in whichever unit is provided to the function
"""
x1 = a[0]
y1 = a[1]
@minorsecond
minorsecond / simulation_function
Created March 16, 2016 09:10
Function that is not running correctly
def simulation():
"""
Main simulation function.
:return:
"""
rowNum = 1
day = 1
number_humans = session.query(Humans).count()
number_vectors = session.query(Vectors).count()
@minorsecond
minorsecond / stronk.py
Created June 17, 2015 14:31
This should return True but doesn't. The dict 'warmup_weight' is constructed in such a weird way. It should appear just like 'warmup_test.'
def warmup(weights):
warm_perc = [.5, .6, .7, .85]
warmup = [] # list of warmup weights
weights = {'squat': 100, 'bench': 100, 'row': 100, 'ohp': 100,
'deadlift': 100} # dict of user's working set weights
warmup_weight = weights
# The values I want...
warmup_test = {'squat': [50, 60, 70, 85], 'bench': [50, 60, 70, 85], 'row': [50, 60, 70, 85],
'ohp': [50, 60, 70, 85], 'deadlift': [50, 60, 70, 85]}
@minorsecond
minorsecond / timeclock.cpp
Created June 13, 2015 20:24
This code produces: "'jobs::abbrev' cannot appear in a constant-expression" and "note: in expansion of macro 'HIBERLITE_NVP'"
class jobs
// Jobs table in timesheet.db
{
friend class hiberlite::access;
template<class Archive>
void hibernate(Archive & ar)
{
ar & HIBERLITE_NVP(id);
ar & HIBERLITE_NVP(uuid);
ar & HIBERLITE_NVP(name);
@minorsecond
minorsecond / cout_error
Created June 11, 2015 17:32
cout/cin error
24 #include <stdio.h>
25 //#include <iostring>
26 #include <time.h>
27 #include <stdbool.h>
28 #include <string.h>
29 #include <list>
30 //#include <hiberlite.h>
31
32 char DB_NAME;
33 char LOGLEVEL;