Skip to content

Instantly share code, notes, and snippets.

View minorsecond's full-sized avatar

Robert Ross Wardrup minorsecond

View GitHub Profile
@minorsecond
minorsecond / p_estimator.py
Created April 30, 2015 16:41
Broken UI (radio button doesn't work.)
class WindowClass(QtGui.QMainWindow, form_class):
def __init__(self, parent=None):
QtGui.QMainWindow.__init__(self, parent)
self.setupUi(self)
self.run_button.clicked.connect(self.run_button_clicked) # Bind the event handlers
def run_button_clicked(self):
global dms
@minorsecond
minorsecond / tc.py
Created May 19, 2015 00:01
Sqlalchemy/Sqlcipher code
if encryption is True:
print("***PYPER TIMESHEET UTILITY***")
print("\nEnter encryption password below:")
key = getpass.getpass()
DB_NAME = ".timesheet.db?cipher=aes-256-cfb&kdf_iter=64000"
engine = create_engine('sqlite:///{}'.format(DB_NAME), module=sqlite)
else:
print("WARNING: Unencrypted session. Install pysqlcipher3 to enable encryption\n")
engine = create_engine('sqlite:///{}'.format(DB_NAME))
@minorsecond
minorsecond / part_tc.py
Created May 21, 2015 14:57
Seg fault 'EVP_CIPHER_key_length () from /lib64/libcrypto.so.1.0.0' When running queries sel or job_sel.
if encryption is True:
print("***PYPER TIMESHEET UTILITY***")
print("\nEnter encryption password below:")
key = str(getpass.getpass())
DB_NAME = ".timesheet.db"
engine = create_engine(
'sqlite+pysqlcipher://:{0}@/{1}?'
'cipher=aes-256-cfb&kdf_iter=64000'.format(key, DB_NAME))
DBSession = sessionmaker(bind=engine)
@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;
@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 / 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 / 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()
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 / 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)
@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